Netbeans Visual Web Selecting Rows
The UI presentation layer doesn’t hold state about which rows were selected.
Winston Prakash outlines how selecting a single row in Netbeans JSF table can be done, but it was a little roundabout.
Here’s a simpler take on it:
Bind a TableRowGroup’s selected attribute to a property on your page.
<ui:tableRowGroup
binding="#{Page1.tableRowGroup2}"
id="tableRowGroup2"
selected="#{Page1.selected}"
sourceData="#{Page1.myDataProvider}"
sourceVar="currentRow">
Next just write the callback function, in our case, the selected row is the current cursor row, but it could be anything of course:
public boolean getSelected()
{
RowKey rk = (RowKey) getValue("#{currentRow.tableRow}");
return rk.equals(myDataProvider.getCursorRow());
}
2 Comments
Jump to comment form | comments rss [?] | trackback uri [?]