Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Prasad PG on Sep 05, 2008 10:06
open dhtmlx forum
master checkbox, on check of master checkbox all rows in all pages get checked

I'm using pagination (1.6 version, toolbar) for my pages. I have grouped 10 rows in a page and there are 16 pages. The issue is when i check the master checkbox in any of these pages, all the rows in all the pages gets checked.

My requirement is only the rows in a particular page should be checked in which i have checked the master checkbox. i.e. I want the check and uncheck to work only on page level instead of all of the pages.
Answer posted by Support on Sep 08, 2008 03:23
You can try to redefine _in_header_master_checkbox method in the dhtmlxgrid_filter.js (lines 377-400) as follows:

dhtmlXGridObject.prototype._in_header_master_checkbox=function(t,i,c){
    t.innerHTML=c[0]+"<input type='checkbox' />"+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;
        if(self.pagingOn){
            var row_start = self.rowsBufferOutSize*(self.currentPage-1);
            for(var r = row_start; r < (row_start + self.rowsBufferOutSize); r++){
                var c=self.cells2(r,j);
                if (c.isCheckbox()) c.setValue(val);
            }
        }
        else{
            self.forEachRow(function(id){
                var c=this.cells(id,j);
                if (c.isCheckbox()) c.setValue(val);
            });
        }
        (e||event).cancelBubble=true;
    }
}