How to use personnal checkbox into a grid

Hi all,

I need to do a simple action but implement is quiet difficult.

i have a grid with attachHeader (’#personnal_master_checkbox’,…)
then i need to select all into the current page of my grid and only the current page.

checking all the row into the current page is ok

dhtmlXGridObject.prototype._in_header_personnal_master_checkbox=function(t,i,c){
t.innerHTML=c[0]+""+c[1];
var self=this;

t.firstChild.onclick=function(e){
	self._build_m_order();
	var j=self._m_order?self._m_order[i]:i;
	var val=this.checked?1:0;
	var state=self.getStateOfView();
	for (var k=state[1]; k<state[2]; k++){
		var c=self.cellById(self.getRowId(k),j);
		if (c.isCheckbox()) c.setValue(val);
	}
	(e||event).cancelBubble=true;
}

}

My problem is when i change page, i still have the position of the checkbox from the last page action. Sample :

  1. i click the checkbox on page 1
  2. action OK all row from page 1 are selected
  3. i go to page 2
    4)all row from page 1 are still selected ( it’s ok ), all row of page 2 are unselected ( OK ) but the header is not updated and still checked

So to check all the page 2 i have to unselect the header then to check it again.

My question is how to update the attachHeader Object on page Change.

Thanks for your answer.

Regards

grid.attachEvent("onPageChanged", function(){ grid.hdr.rows[1].cell[0].getElementsByTagName("input")[0].checked = false; });

0 in above code - index of column with checkbox

As per this solution on 2nd page we are not getting header checkbox tick. But when we are going back to first page header checkbox is unselected and the rest of the below checkboxes are checked.

How to resolve this?

You may try to save the state of the checkbox for each page and load the needed state after the the paging.
Or you may iterate through the rows and clear all checkboxes on the page.