af:table failed to return the current selected row
724489Sep 25 2009 — edited Oct 13 2009I had problem getting the current selected row from a read-only table.
The table was binded to a view object which was customized to load data from a stored procedure. The data was displayed correctly in the table but no working with the selection.
Regardless which row I selected, the table component getSelectedRowData() always return the first row of the collection.
When I access the selected row in my bean as following:
FacesCtrlHierNodeBinding data = (FacesCtrlHierNodeBinding)getTestTable3().getSelectedRowData();
The table on the page was set up as following:
<af:table value="#{bindings.UCOTry1VO1.collectionModel}" var="row"
rows="#{bindings.UCOTry1VO1.rangeSize}"
emptyText="#{bindings.UCOTry1VO1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.UCOTry1VO1.rangeSize}"
rowBandingInterval="0"
selectedRowKeys="#{bindings.UCOTry1VO1.collectionModel.selectedRow}"
selectionListener="#{bindings.UCOTry1VO1.collectionModel.makeCurrent}"
rowSelection="single" id="t3"
binding="#{testFormBean.testTable3}">
<af:column sortProperty="PO_NO" sortable="false"
headerText="#{bindings.UCOTry1VO1.hints.PO_NO.label}"
id="c11">
<af:outputText value="#{row.PO_NO}" id="ot11"/>
</af:column>
<af:column sortProperty="DESCRIPTION" sortable="false"
headerText="#{bindings.UCOTry1VO1.hints.DESCRIPTION.label}"
id="c10">
<af:outputText value="#{row.DESCRIPTION}" id="ot10"/>
</af:column>
</af:column>
</af:table>
Do I need to override any method on the View object so that when it binded to a af:table, the current row will be updated correctly?
Any possible way or suggestion to debug the issue?