Scenario:
How to enable single row table selection?
Solution:
This seems an obvious question but newbie’s miss to understand this and will find difficulties in fixing this.
So what exactly we do to make the selection happen and confirm that it points to the current row of the af:table.
first, make sure that you have the following entries added to the af:table component of your page
selectedRowKeys="{bindings.Customers.collectionModel.selectedRow}" selectionListener="#{bindings.Customers.collectionModel.makeCurrent}" rowSelection="single"
Note: Customers is the tree binding for the table in the page definition file.
So what these entries do?
selectedRowKeys – the state of the selection is stored in this property. This property identifies the current selected row in the collectionModel of the table.
selectionListener – this is a listener that corresponds to the selection of the row. we bind it to the makeCurrent method of the table bindings collectionModel
rowSelection – we make it single row selection.