permaculture playing cards
The moose likes JSF and the fly likes SelectAll checkbox in header column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "SelectAll checkbox in header column" Watch "SelectAll checkbox in header column" New topic

SelectAll checkbox in header column

Charles Ben

Joined: Jun 02, 2009
Posts: 8

Im using datatable and i got a requirement to have a checkbox in the header section along with the label "Action"
on select it should select all the checkboxes under that column and on uncheck it should
uncheck all the selected checkboxes below ..

Could someone suggest the approach to be taken for this scenario.
is it possible to add another checkbox alongside header label under same facet tag?
Rajneesh Kumar Rajput
Ranch Hand

Joined: Feb 25, 2009
Posts: 39
Yes, it is perfectly valid you can use panelGrid inside the facet and have the header checkbox along with the header label.

simply you can java script to select and un select all the other rows checkboxes.
Charles Ben

Joined: Jun 02, 2009
Posts: 8
Thanks Rajneesh

I made the header column as Command link and called the action to do the select/deselect functionality in backing bean class.
Javascript was slowing down when the data was more in datatable and so went wth java implementation.

I agree. Here's the link:
subject: SelectAll checkbox in header column
It's not a secret anymore!