Search code examples
orbeonxforms

In repeat section make column invisible


it's easy to make invisible row in repeat section. But we need to make invisible first column of repeat. How can we make it?


Solution

  • Assume you have 4 columns for each row containing the below information,

    DOJ EmpId   EmpName Department
    

    and the node look like this

    <employee>
    <doj/>
    <emp-id/>
    <emp-name/>
    <department/>
    </employee>
    

    then the xforms:repeat content will look like this

    <xforms:repeat nodeset="instance('main-instance')/employees/employee" id="employee-repeat" >
    <tr>
    <xforms:group ref=".[your condition]">
    <td>
        <xforms:output ref="doj" />
    </td>
    </xforms:group>
    <td>
        <xforms:output ref="emp-id" />              
    </td>
    <td>
        <xforms:output ref="emp-name" />                
    </td>
    <td>
        <xforms:output ref="department" />              
    </td>
    </tr>
    </xforms:repeat>
    

    Now, since you does not want to show the first column( in this case doj) on all rows, simply remove the first <td> inside the repeat content.

    Update:

    Based on OP Comment, yes we can hide and show instead of removing the code by using <xforms:group> tag. Above code is modified to reflect this.