22 September 2016

Column Reordering Problem in Dynamic Table in ADF

Hi All,

Few days back I got an issue in ADF related to reordering of column in ADF dynamic table. The issue was reordering was not happening in dynamic table created in ADF 12c, but reordering was happening for dynamic table created in ADF 11g.

So I started comparing the both table which was built dynamically in ADF 11g and 12c and found that in ADF 11g the code of the dynamic table generated was as follows:

        <af:table rows="#{bindings.EmployeesVO1.rangeSize}"
                  fetchSize="#{bindings.EmployeesVO1.rangeSize}"
                  emptyText="#{bindings.EmployeesVO1.viewable ? 'No data to display.' : 'Access Denied.'}"
                  var="row" rowBandingInterval="0"
                  value="#{bindings.EmployeesVO1.collectionModel}"
                  selectedRowKeys="#{bindings.EmployeesVO1.collectionModel.selectedRow}"
                  selectionListener="#{bindings.EmployeesVO1.collectionModel.makeCurrent}"
                  rowSelection="single" id="t1">


          <af:forEach items="#{bindings.EmployeesVO1.attributeDefs}" var="def">
            <af:column headerText="#{bindings.EmployeesVO1.labels[def.name]}"
                       sortable="true" sortProperty="#{def.name}" id="c1">
              <af:outputText value="#{row[def.name]}" id="ot1"/>
            </af:column>
          </af:forEach>

 
        </af:table>


But the code generated in ADF 12c was as follows:

 <af:table value="#{bindings.EmployeesVO1.collectionModel}" var="row"
                          rows="#{bindings.EmployeesVO1.rangeSize}"
                          emptyText="#{bindings.EmployeesVO1.viewable ? 'No data to display.' : 'Access Denied.'}"
                          rowBandingInterval="0" fetchSize="#{bindings.EmployeesVO1.rangeSize}"
                          filterModel="#{bindings.EmployeesVO1Query.queryDescriptor}"
                          queryListener="#{bindings.EmployeesVO1Query.processQuery}" filterVisible="true" varStatus="vs"
                          id="t1">


                    <af:iterator id="i1" value="#{bindings.EmployeesVO1.attributesModel.attributes}" var="column"
                                 rows="0">
                        <af:column headerText="#{column.label}" sortProperty="#{column.name}" sortable="true"
                                   filterable="true" id="c1">
                            <af:dynamicComponent id="d2" attributeModel="#{column}"
                                                 value="#{row.bindings[column.name].inputValue}" readOnly="true"/>
                        </af:column>
                    </af:iterator>


                </af:table>


So here you can easily see that in ADF 11g the dynamic column is getting created with the help of  <af:forEach> whereas in ADF 12c it is getting created with the help of  <af:iterator>.

Both does the same thing but somehow the ordering in table is not working. So I have changed the <af:iterator> in 12c by <af:forEach> and checked. 

Surprisingly it started working fine after that. So whenever you get this issue just replace 
<af:iterator> by <af:forEach> in your dynamic table. 


0 on: "Column Reordering Problem in Dynamic Table in ADF"