collapseAllGroups() does not collapse the group.

We are loading the grid through xml. Grouping is used in the grid. When the grid is loaded initially, I want the groups to be collapsed by default.
The following code doesn’t work:


I tried using grid.collapseGroup(val) as well, it doesn’t work too,
Though I use the above code, the groups are expanded by default initially.
is there any other api to be used along with the above?

Make sure that you call the method after the xml is loaded.

grid.loadXML(“data.xml”, function(){

If issue still occurs - please provide any kind of sample or demo link to reconstruct the issue

thanks, that works.

then i have one button, on click of that i want to collapse all groups,
$(document).on(‘click’, ‘.collapseButton’, function (event) {

the click events and grid.collapseAllGroups(); execute properly, but the groups didn’t collapse.

+Department EmployeeName Salary DateOfBirth

  • Dept1 Name1 10000 12-1-1980
  • Dept2 Name2 20000 13-1-1980
  • Dept3 Name3 30000 14-1-1980
  • Dept4 Name4 40000 15-1-1980
  • Dept5 Name5 50000 16-1-1980

Actually i want to create grid like this, want to create + button near header of Department. On Click of that want to collapse all groups.

Unfortunately the problem cannot be reconstructed locally.
Could you please, share a demo link or provide a complete demo, where the problem can be reconstructed.