JSF datatable row selection
How to s开发者_Python百科elect multiple rows in a JSF datatable?
You can either place a checkbox on each row giving it a value of #{currentRowItem.selected}
or use <rich:extendedDataTable>
Create a Map<Integer, Boolean> selectMap
in the backing bean. (If the key is not model's id and key is a string, create a Map with String, Boolean pair ..)
For every row provide a checkbox #{backingBean.selectMap[rowvar.selectedId]}
You must be able to find the selected values in the map after each selection.
you can use primefaces as follow:
<p:dataTable id="tableId" var="data" value="#{myBean.myList}"
selection="#{myBean.selectedDTOs}"
rowKey="#{data.objectId}">
<p:column selectionMode="multiple" />
</p:dataTable>
精彩评论