Using displaytag 1.1, is it possible to allow user to page through records selecting a few on each page? I am able to add a checkbox column allowing for selection of records but what is the best way to track selections made by user on each page and accumulate them.
Thanks,
vyv
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You'll need to change the links anyways to be able do gets and carry over sorting and paging parameters. But this is easy. Just specify any parameters you want to carry from page to page (except for displaytag parameters) on the page link and use this as the value for the requestURI attribute on the display:table tag. Look through this forum and the mailing list archives for requestURI and you should find a number of posts that address this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I could be wrong, but I don't really see a way to do this today with display tag the way it is. I think it could probably be done by reverse-engineering (a strong term) the way display tag generates links and biulding the links yourself though.
What you'd essentially need to do is have the whole display table wrapped in a form - it sounds like you have this already. Then have the next/previous links submit that form with the addition of the parameters that manage paging/sorting etc. If you could do that, you could then add a little chunk of logic (JSTL tags or scriptlet could do it) to pull in all the values of the checkbox submitted on the previous page and write them back out as a hidden field on the current page.
Anyway, from what I can see it would appear that the way display tag builds it's paging links, you can't get it to trigger a form submit. Event if you specified requestURI="javascript:myFunc()" and had your function submit the form....I think you'd end up with malformed paging URLs that looked like:
<a href="javascript:myFunc()?foo=bar&l=1238"/>
Perhaps one of the developers can suggest a workaround for this - or better yet something I've missed :)
Hi,
Using displaytag 1.1, is it possible to allow user to page through records selecting a few on each page? I am able to add a checkbox column allowing for selection of records but what is the best way to track selections made by user on each page and accumulate them.
Thanks,
vyv
Thank you for your reply Tim - I also realised that one would need to modify the way the links are generated and that is probably not the best way.
Regards
vyv
You'll need to change the links anyways to be able do gets and carry over sorting and paging parameters. But this is easy. Just specify any parameters you want to carry from page to page (except for displaytag parameters) on the page link and use this as the value for the requestURI attribute on the display:table tag. Look through this forum and the mailing list archives for requestURI and you should find a number of posts that address this.
I could be wrong, but I don't really see a way to do this today with display tag the way it is. I think it could probably be done by reverse-engineering (a strong term) the way display tag generates links and biulding the links yourself though.
What you'd essentially need to do is have the whole display table wrapped in a form - it sounds like you have this already. Then have the next/previous links submit that form with the addition of the parameters that manage paging/sorting etc. If you could do that, you could then add a little chunk of logic (JSTL tags or scriptlet could do it) to pull in all the values of the checkbox submitted on the previous page and write them back out as a hidden field on the current page.
Anyway, from what I can see it would appear that the way display tag builds it's paging links, you can't get it to trigger a form submit. Event if you specified requestURI="javascript:myFunc()" and had your function submit the form....I think you'd end up with malformed paging URLs that looked like:
<a href="javascript:myFunc()?foo=bar&l=1238"/>
Perhaps one of the developers can suggest a workaround for this - or better yet something I've missed :)
-Tim Fennell
Stripes: http://stripes.mc4j.org/