Call custom function for Master_Checkbox

I have a master checkbox in my grid. When i click the master checkbox, it performs the default behaviour of checking/unchecking the checkboxes in its respective column. Its okay till here.

I want to call a function when the master checkbox is selected/unselected. How do a assign a custom function to it…Is there a way to attach an Event to this master checkbox.

It can be done only with code modification. In the file dhtmlxgrid_filter.js:

dhtmlXGridObject.prototype._in_header_master_checkbox=function(t,i,c){
t.innerHTML=c[0]+""+c[1];
var self=this;
t.firstChild.onclick=function(e){
//any custom code here

}
}