Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Jun 24, 2009 05:14
open dhtmlx forum
grid filter checkbox checked values

hi,

in DhtmlX grid i have a column as master checkbox on grid header,

<column width='50' type='ch' align='center' xmlcontent='1'>
<center><input type='checkbox' onclick='checkState()'></center>
</column>

When user check/ un check all the rows in grid are checked /unchecked.

But my question is when user search using filter and click on header check / un check irrespective of search result all the rows in the grid are checked, how to prevent that.

Answer posted by Alex (support) on Jun 24, 2009 06:30

Hello,

which approach do you use to organize loop through all rows in grid ?

In case of following approach - only visible rows will be taken into consederation:

for(var i=0;i<grid.getRowsNum();i++){
  grid.cells2(i,column_index).setValue(state))
}

Answer posted on Jun 25, 2009 10:25

right now i am doing this

for (var i=0; i<mygrid.getRowsNum(); i++)

SearchGrid.render_row(i);

before changing the checkbox state in the grid.

 

what you are saying when user search and then choose checkbox i shouldnt do the above process and need to do as below process ?

for(var i=0;i<grid.getRowsNum();i++){
  grid.cells2(i,column_index).setValue(state))
}

Answer posted by Alex (support) on Jun 26, 2009 04:01

Yes,

  if you want to check only visible rows using your checkState() function, you should use the approach that was recommended in the previous answer:

for(var i=0;i<grid.getRowsNum();i++){
  grid.cells2(i,column_index).setValue(state))
}

Answer posted on Jun 26, 2009 04:58
thanks for your clarification