开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜