• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

To select all checkbox across all pages in an application

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
The knights of nee want a shrubbery. And a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic