# Recursive walk through a grid with paging?

Tegomena
33 4

Hello,

I have a grid with paging. The first column contains always a checkbox which is per default not checked. Now, I want to have a button "Select all" which activates all checkboxes in the grid.

I wrote a recursive function which goes through all child elements of the grid and actiavtes the checkboxes. Unfortunately, it seems so that the grids children are just created "on demand", as the user clicks through the pages. For example, if we have 4 pages with entries and the user watches just the first one, only the checkboxes on the first page get activated.

Any idea how we can solve that easily (ZK 7.0.3)?

And here is my recursive function:

public void checkAllCheckboxes(Component g) {

if (g instanceof Checkbox) {
((Checkbox) g).setChecked(true);
}
List<Component> list = g.getChildren();
for (Component child : list) {
checkAllCheckboxes(child);
}
}

delete retag edit

hello Tegomena, to do this in a simple way, separates the data from the view with the mvvm technique, and you will have no problem with paging.

( 2017-10-27 17:38:38 +0800 )edit
Be the first one to answer this question!
[hide preview]