Skip to main content

How to stretch a column in a dynamically generated <af:table>

I happened to notice an interesting thread in an internal discussion forum on last week. Question was, how to stretch a column in a dynamically generated <af:table>? Andrew Robinson provided an elegant solution for this query. I'm copying the same idea here as well for your reference.

If you want to stretch a column in a dynamically generated table, then one possibility is to use an EL to fix the component ID to an 'Identifier' that changes per forEach iteration. Please see the below given tag snippet to get a more clear picture on the implementation part.

 <af:table rows="#{bindings.DynamicVO.rangeSize}"  
      fetchSize="#{bindings.DynamicVO.rangeSize}"  
      emptyText="#{bindings.DynamicVO.viewable ? 'No data to display.' : 'Access Denied.'}"  
      var="row" rowBandingInterval="0"  
      columnStretching="column:clmn1"  
      value="#{bindings.DynamicVO.collectionModel}"  
      selectedRowKeys="#{bindings.DynamicVO.collectionModel.selectedRow}"  
      selectionListener="#{bindings.DynamicVO.collectionModel.makeCurrent}"  
      rowSelection="single" id="t1"  
      styleClass="AFStretchWidth">  
  <af:forEach items="#{bindings.DynamicVOIterator.attributeDefs}"  
        var="def" varStatus="vs">  
   <af:column headerText="#{def.name}" sortable="true"  
         sortProperty="#{def.name}"  
         id="clmn${vs.index}"> 
    <af:inputText value="#{row.bindings[def.name].inputValue}"  
            maximumLength="#{row.bindings[def.name].hints[def.name].precision}"  
            id="fld1"/>  
   </af:column>  
  </af:forEach>  
 </af:table>  

Comments

SudeepShakya said…
This comment has been removed by a blog administrator.
Girish said…
I have tried with above mentioned snippet for stretching the column for dynamic table it is not working .Can you please let me know need to do something more.







Popular posts from this blog

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…