I have a data table and there are check boxes of each row and I would like to implement the Select All and Clear All links at the bottom of Data Table.
And as expected it should select all or clear all, all the checkboxes in data table.
Please let me, how to do this.
Thank You,
This message was edited 1 time. Last update was at by Bear Bibeault
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1397
posted
0
Can you explain at what point are you stucked?
- Varun
srikanth koppisetty
Greenhorn
Joined: Feb 14, 2005
Posts: 20
posted
0
I would like to implement, but i do not know the way, since if i use the java script, how to call the JSF component.
So, if you have implemented this, please let me know and if possible please send me sample code of jsf file.
Thanks in advance.
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1397
posted
0
Do it on server side. If the user clicks "Select all", go to backing bean's listener method and set the boolean property mapped to your checkbox to "true" for all objects in collection. Similar approach will work for uncheck option too.
Prakash Jebaraj
Greenhorn
Joined: Mar 14, 2005
Posts: 5
posted
0
Here is the client side code.
In the page bean, have a property to hold the count of rows displayed in the datatable and add inputHidden component in the form
Originally posted by Varun Khanna: Do it on server side. If the user clicks "Select all", go to backing bean's listener method and set the boolean property mapped to your checkbox to "true" for all objects in collection. Similar approach will work for uncheck option too.
I'd second that for a couple of reasons.
With JSF you need to just break down and think Server Side. Javascript is good but what happens when someone visits your site that doesn't have Javascript turned on. At the very least have it work both ways. I typically just don't bother with JS unless I have to
Page stay much cleaner if you do all the work in the backing bean.
This is not JSP/Servlet programming. This is JSF. A component oriented framework. Think components, think actions, think GUI's. Stop thinking HTML.
I�m trying the JSF approach, but the problem is that I use some of the check box components appear on other pages. So after doing a select all on one page, I go to another page, those same boxes would render as checked. They would need to be reset somehow, but I'm not sure how I would approach it. Any suggestions? Thanks!
NaviNice Naveen
Greenhorn
Joined: Aug 04, 2010
Posts: 2
posted
0
Hi,
Every One I am New in JSF,,
I have to select all checkboxes on click of a button,,,,,,,,,,,,,,,
I am not using javascript ,,,
Please can you tell me , How Can handle this with actionListner ???
As Mr. Varun Khanna Suggest...
NaviNice Naveen
Greenhorn
Joined: Aug 04, 2010
Posts: 2
posted
0
I have done select all checkboxes on click of a button in jsf on server side.
But o server it taking 5-6 sec...
it is taking too much time ,
i want to ask that,
What is the good way to this work.
1 . Do In server Side
2. Do in client Side..........
Suggest me.....
subject: Select All and Clear All implementation in JSF