• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

To select all checkbox across all pages in an application

 
kannan coding
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My search action returns results as per pagination(i.e if 100 records are there, 10 records per page is displayed) and each record or a row of the search result will have a check box and it has a unique id.

Now i need select all the check boxes present in all the pages i.e if 10 pages are there i.e totally 100 records, all the 100 check boxes should be selected on click of one check box in the first page.
All the final operation(add/delete/update) should consider all these check box ids which are checked for further operations.

And if the user deselects one check box the final action should not consider that unchecked box id.

How can i proceed with this. Give me some logic for doing this.

Can i have a temp table to have the status and check box id or is there any other easy way of doing this.

Thanks in advance.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to use JavaScript to do this. In addition, if the checkboxes aren't all physically on the page (i.e., hidden etc.) you'll have to add logic that will simulate their submission.
 
kannan coding
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java script can be used if the results are in one page. Since i am using pagination logic only while requesting the next page i will get the next sequence of records from database, in that case how can i maintain all the check box values in my form.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a Struts question.

As I said, you'd have to simulate their submission.

One way would be to include hidden fields for all the checkboxes, even the ones that aren't being currently displayed. Another would be to create the checkboxes on submission via JavaScript given a list of all the IDs, and would reduce the browser memory footprint somewhat.
 
kannan coding
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by this statement "you'll have to add logic that will simulate their submission"
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean if you don't have actual hidden checkboxes then you'd have to create some means of submitting all the relevant values without them (the checkboxes), like a comma-separated list of IDs in a hidden text input that's then parsed by the action.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic