Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Max on Sep 10, 2008 01:40
open dhtmlx forum
Remove group

Hi

We have grid with groupping.

We need to be able to remove group with all rows inside.

For the moment we do not see any available APIs for this.

Also if we remove rows from group - anyway even empty - group stays in grid.

Can you advise if there is a method to remove [empty] group from grid or at least refresh grid but to keep state of groups (collapsed - non-collapsed).


if you give us any idea how to deal with this - that would be great!

Thanks in advance.
Answer posted by Support on Sep 10, 2008 04:54
>>Also if we remove rows from group - anyway even empty - group stays in grid.
Actually, if all rows deleted from the group - group will be removed automatically. 
You can check 
    http://dhtmlx.com/docs/products/dhtmlxGrid/samples/extended_modes/pro_group.html?un=1221043500000
deleting all rows in one of groups will remove group as well. 

>>We need to be able to remove group with all rows inside.
The grid's API doesn't give direct access to sub-rows inside group, but you can loop through dataset and delete all rows with specific cell value. 

 var value="Stephen King";
 mygrid.forEachRow(function(id){
  if (mygrid.cells(id,2).getValue()==value)
  mygrid.deleteRow(id)
 })

//will delete "Stephen King" group