Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by sriram on Jul 13, 2009 04:12
open dhtmlx forum
Master Check box

Hi,

I have a master check box in the grid. When the grid is loaded, if all the check boxes are in checked state then the master check box should also be in checked state, but at present, it's not. What should I do for that? Is there any predefined functionality?

Second one is, I am getting the changed rows data(if the checkbox state is changed from checked to unchecked or the reverse) by the method getChangedRows(0). I need to pass only this data to the server side for processing. The problem is, say the initial state of the checkbox is checked, I changed it to unchecked and then back to checked again, so ideally the changed rows are zero but the method is returning the rowid of the grid. Please provide a solution for this.

Thanks,
sriram.
Answer posted by dhxSupport on Jul 13, 2009 08:22
>> When the grid is loaded, if all the check boxes are in checked state then the master check box should also be in checked state, but at present, it's not
Current version of master_checkbox doesn't support such functionality. You can implement custom header|footer shortcut. Please see more information here http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Custom_content_in_header.htm#grid_ccingrid

>>I need to pass only this data to the server side for processing. The problem is, say the initial state of the checkbox is checked, I changed it to unchecked and then back to checked again, so ideally the changed rows are zero but the method is returning the rowid of the grid

After checking check boxes with master_checkbox you shoudl mark necessary rows as updated:
In the file dhtmlxgrid_filter.js following line:
if (c.isCheckbox()) c.setValue(val);
could be changed with:
if (c.isCheckbox()) {
  if (parseFloat(c.getValue())!=val){
  c.setValue(val);
  c.cell.wasChanged=true;
  dp.setUpdated(id,true,"updated")//dp - instance of DataProcessor.
  }
  }