0
votes

I am using Ng-Grid with grouping option, where groups are collapsed by default. Each row of data has a link to perform some operation on it. After operation is done, grid should refresh data. This part works fine.

The problem is with aggregation: after data refresh, all rows get collapsed. This is really annoying.

Is there any possibility to expand specific group after data refresh? I tried:

$scope.gridOptions.ngGrid.rowFactory.aggCache[$scope.expandedGroupID].toggleExpand();

and

$scope.gridOptions.ngGrid.rowFactory.aggCache[$scope.expandedGroupID].collapsed=false;

But that didn't work.

Example Plunker with grid configuuration can be found here

2

2 Answers

0
votes

If anyone struggles with the same problem, here is how I fixed that:

$scope.$on('ngGridEventData', function () {
    $scope.availableGroupsOptions.ngGrid.rowFactory.aggCache[idx].toggleExpand();      
});

The key is 'ngGridEventData'.

0
votes

Or go to the ng-grid.js and make groupsCollapsedByDefault to false.

So if you refresh the grid in that case the grid status will remains the same (collapsed grid will be collapsed and expanded grid will remain expanded.)

Thank you. I hope this helps, Chess !!