0

i have implemented pagination in jsp.these values will come from DB. checkboxes are there against each record.when user checks 3 records in 1st page and goes to 2nd pages and again comes back to 1st page whatever user checked previously it should be checked.how to maintain this state in javascript ?How to achieve this functionality.i need to maintain the checkbox state across multiple pages?

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Airshow
0

Chaituu,

The easiest (and arguably the most reliable) approach is not to allow your 1st page to be destroyed. You can do this by opening 2nd page in either a popup window or within a iframe on the same page.

Otherwise, the solution depends on how the user returns to the 1st page.

If they use "back" (either the browser's back button or its scripted version), then 1st page may redisplay the correct check marks automatically (in some browsers some of the time).

However, if the user clicks a link that causes the 1st page to be recomposed and re-served, then realistically, your best choice is to coordinate things server-side. To facilitate this, you will need to store values (eg. three item ids) either client-side in a cookie, or server-side in the "session". Either way, you will need to arrange for your jsp code to recreate the checkmarks in accordance with the saved values.

There are also Ajax techniques, but you need not really consider these unless you are already using Ajax for other reasons.

Hope this helps.

Airshow

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.