Not getting the value of only checked rows


I have implemented pagination every page showing 10 records, i have 7 pages.

When i checked all the rows of the first page and after that if i am calling mygrid.getCheckedRows(1). It is giving me the IDs of all the rows i had checked. That is fine.

The problem is that if i unselect again all the checkboxes by unchcking my all check check box it is uncyhecked all the rows in first page. But if i again selected all the rows in the second page, then it is appening all the ids of the first page along with the ids of second page.

My requirement is to get the selected ids of the current page only.

Plz help me ASAP it is urgent.

It can be done only with code modification. In the file dhtmlxgrid_filter.js lines
var c=this.cells(id,j);
if (c.isCheckbox()) c.setValue(val);

could be changed with:
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);