-
1. Re: rich:extendedDataTable - select all items
ilya_shaikovsky Mar 30, 2009 11:56 AM (in response to tobi04)You could use selection attribute to submit selection (the same as for scrollable sample).. so in the same way you could make all the items selected in some your action.
-
2. Re: rich:extendedDataTable - select all items
tobi04 Mar 31, 2009 5:14 AM (in response to tobi04)Hi Ilya,
thanks for your reply.
I implement your idea as you can see below.
If no row is selected in the table the "select all" and "deselect all" buttons work fine.
If I select one or more rows and click on the "deselect all" button then the rows still selected.
What do I forget?<h:panelGrid id="mainPanel" style="table-layout: fixed;" columns="2" columnClasses="leftColumn, rightColumn"> ... <a4j:commandButton value="select all" action="#{extendedDataTableBean.selectAll}" reRender="mainPanel" /> <a4j:commandButton value="deselect all" action="#{extendedDataTableBean.selectAllNot}" reRender="mainPanel" /> ... <rich:extendedDataTable id="demoTable" value="#{extendedDataTableBean.dataModel}" var="patient" style="margin: 0 auto;" rows="#{extendedDataTableControlBean.rowsNumber}" width="#{extendedDataTableControlBean.width}" height="#{extendedDataTableControlBean.height}" selectedClass="dataTableSelectedRow" footerClass="demo-footer" sortMode="#{extendedDataTableControlBean.sortMode}" selectionMode="#{extendedDataTableControlBean.selectionMode}" selection="#{extendedDataTableBean.selection}" rowKeyVar="rkvar" tableState="#{extendedDataTableBean.tableState}" > ... </h:panelGrid> public class ExtendedDataTableBB { ... private SimpleSelection selection = new SimpleSelection(); ... public void selectAll() { selection.setSelectAll(true); } public void selectAllNot() { selection.setSelectAll(false); }
-
3. Re: rich:extendedDataTable - select all items
tobi04 Apr 1, 2009 6:25 AM (in response to tobi04)Hi all
the problem still exists. Any ideas?
Best regards
Tobi -
4. Re: rich:extendedDataTable - select all items
ilya_shaikovsky Apr 1, 2009 9:53 AM (in response to tobi04)set the buttons ajaxSingle="true". selection itself submitted and so new one not considered.
B.t.w. I will recheck the way we considered isSelectAll at encode if selection itself contains elements and update if some more problems appears. -
5. Re: rich:extendedDataTable - select all items
ilya_shaikovsky Apr 1, 2009 9:56 AM (in response to tobi04)b.t.w. setSelectAll(false) will not work as you await.. because it just tells that all rows are not selected. But selection items in list still actual and the list isn't empty.
But setSelectAll(true) should works fine at list with ajax Single. -
6. Re: rich:extendedDataTable - select all items
ilya_shaikovsky Apr 1, 2009 11:34 AM (in response to tobi04)even ajaxSingle not nesessary. our simple implementation just not consider the all selected property if the selected items set not empty. You could clean the set in your action before setting select all or just fill the set with all items. and just clear this set for deselection.
-
7. Re: rich:extendedDataTable - select all items
tobi04 Apr 3, 2009 6:33 AM (in response to tobi04)Hi Ilya,
thanks for your reply.
Your tips (selection.clear()) were very helpful and now my solution works and looks like this:<h:panelGrid id="mainPanel" style="table-layout: fixed;" columns="2" columnClasses="leftColumn, rightColumn"> ... <a4j:commandButton value="select all" action="#{extendedDataTableBean.selectAll}" reRender="mainPanel" /> <a4j:commandButton value="deselect all" action="#{extendedDataTableBean.selectAllNot}" reRender="mainPanel" /> ... <rich:extendedDataTable id="demoTable" value="#{extendedDataTableBean.dataModel}" var="patient" style="margin: 0 auto;" rows="#{extendedDataTableControlBean.rowsNumber}" width="#{extendedDataTableControlBean.width}" height="#{extendedDataTableControlBean.height}" selectedClass="dataTableSelectedRow" footerClass="demo-footer" sortMode="#{extendedDataTableControlBean.sortMode}" selectionMode="#{extendedDataTableControlBean.selectionMode}" selection="#{extendedDataTableBean.selection}" rowKeyVar="rkvar" tableState="#{extendedDataTableBean.tableState}" > ... </h:panelGrid> public class ExtendedDataTableBB { ... private SimpleSelection selection = new SimpleSelection(); ... public void selectAll() { selection.clear(); selection.setSelectAll(true); } public void selectAllNot() { selection.clear(); selection.setSelectAll(false); }
Best regards
Tobi