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.
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>
This comment has been removed by a blog administrator.
ReplyDeleteI 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.
ReplyDelete