how to set selected all checkboxes in all dataTable's rows?

Hi there,

I'm trying to perform this simple task: having a dataTable with a column containing checkboxes, how can I allow (with a button, a "super" checkbox or so) to simultaneously set selected all checkboxes in all rows?

And - is it possible to do so without calling the submit of the page?

Thanks to everyone!

[338 byte] By [teknor] at [2007-11-26 10:59:09]
# 1

Check the Table's properties. You'll see that can be added a visual control for "Select All" and "Deselect All". Then, for full funcionalitiy, take a look at "Tutorial Divas" and Winston Prakash's Weblog and search for how to use checkbox and radiobutton components with tables.

Hope this helps.

Antonio.

antoniovl at 2007-7-7 3:12:44 > top of Java-index,Development Tools,Java Tools...
# 2

Yes, I see it works very well with <ui:table> component - but I'm using an <h:dataTable>, which is among the "Standard" component list. It has other features but not the paginateButton, paginationControls, selectMultipleButton... (or not in the Properties panel).

I suppose there must be a way of implement the same behaviour as in the <ui:table>, but it seems not to be so close at hand...

teknor at 2007-7-7 3:12:44 > top of Java-index,Development Tools,Java Tools...
# 3

Well, if this <h:dataTable> is the one that came with Creator 1, then I remember it had pagination control. The option (when selected) added some code to the page bean, it was not done with javascript.

Does this component generate some javascript code in the JSP file, as do the <ui:table>?

Best regards

Antonio.

antoniovl at 2007-7-7 3:12:44 > top of Java-index,Development Tools,Java Tools...
# 4

Yes, the paging for <h:dataTable> works pretty good, it manages the task through four methods created in the java code -- DataTable1_firstPageAction(), DataTable1_previousPageAction(), DataTable1_nextPageAction(), DataTable1_lastPageAction() -- without adding any javascript in the jsp page.

Maybe I could test if a java script similar to the <ui:table>'s one fit also the dataTable...

thanks

teknor at 2007-7-7 3:12:44 > top of Java-index,Development Tools,Java Tools...