Hi everybody,
The following is my scenario, I'm looking for suggestions about good ways to go
about it.
Many of my pages have grids, and many of these grids have columns whose content
in each row is a checkbox.
If the grid has many rows and so it gets divided into grid pages and it gets a
Pager, if I check some checkboxes in the 1st page of the grid and then use the
Pager to go to the 2nd page of the grid and then to go back to the 1st page,
the checkboxes in the 1st page of the grid have lost their checked state and
are all unchecked. I want the checkboxes to preserve their "checked" state
while paging back and forth over the grid.
The checkbox is created by a <p:> tag in the page template, just before the
</t:grid> closing tag. F.ex. if the Java class is MyPage.java, the grid tag in
MyPage.tml will contain:
<p:myColumnCell>
<input t:type="checkbox"
value="myRecord.myField" .... />
</p:myColumnCell>
In MyPage.java, myRecord is an instance field annotated with @Property .
Currently I handle this by annotating myRecord with @Persist and making sure to
save into it the state of each checkbox that the user changes, so when the user
goes back to page 1 the checkboxes that were checked there are still checked.
However this requires changes in MyPage.java, so if I want this behavior in
other pages I must make the same changes in the Java classes of all those pages.
I'm looking for a way to make changes in only one place and have this
functionality in all the pages that have a grid, without having to make changes
in all the pages. In case, I'm totally open to customizing Grid.java or
GridPager.java or other classes.