How to create a "Check All" button?

I have a grid with one “ch” type column. I want to have a Check All" button to make all the boxes in all rows checked.
There is a problem, because I’m using Paging in this grid: simle

grid.cells2(i, 0).setValue(chkstat);

is not working. When reading values I may use

w = grid.rowsBuffer[i]; if(w != null) v = grid._get_cell_value(w, 0);
Is there some similar trick for writing value into cells?

*all visible rows.

Check this info:

dhtmlx.com/docs/products/dhtmlxG … r_num.html

Only write a attachHeader with the value #master_checkbox
mygrid.attachHeader(“1,2,3,#numeric_filter,#master_checkbox,6,stat,8”);

Thanks.