Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Sujoy Abraham on Sep 09, 2008 00:09
open dhtmlx forum
Regarding the Master Checkbox

hi,

I need to capture the Master Checkbox's events. How can i do it?

I want to know if its selected or de-selected.

(It's urgent)


Thanks & Regards,
Sujoy
Answer posted by Support on Sep 09, 2008 03:48
Can be done only by code modification. 
dhtmlxgrid_filter.js , line 355

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;
  self.callEvent("customMasterChecked",[val]) // this line need to be added


As result you will be able to use
mygrid.attachEvent("customMasterChecked",function(val){
    //any custom code
})


Answer posted on Sep 10, 2008 09:00
How to uncheck the master check box in case if the user selects some child check boc????
Answer posted by Support on Sep 10, 2008 09:38
Something similar to next, may work. 

mygrid.attachEvent("onCheckbox",function(id,ind,value){
if (!value)
      mygrid.hdr.rows[rowInd].cells[cellInd].getElementsByTagName[0].checked=false;
return true;
});

where rowInd and cellInd - position of master checkbox in header.