I have a ng-grid with data that is grouped by category, as shown below:
$scope.gridOptions = {
columnDefs: [
{field: 'cat', displayName: 'Category'},
{field: 'name', displayName: 'Name'},
{field: 'val', displayName: 'Value'}
],
data: 'myData',
groups: ['cat']
}
I would like to be able to un-group the data in the ng-grid externally with a button. I do not want to display the group panel (via $scope.gridOptions.showGroupPanel: true
), which provides an 'X' to clear the grouping.
I have tried executing the following when clicking on the external button without any success:
$scope.gridOptions.groups = [];
$scope.gridOptions.groups.length = 0
Any suggestions on how I can clear the grouping? Ultimately I would like to be able to make the grouping toggle on/off with the button; however, clearing the grouping seems like a good first step. Thanks for your help!
Here is a Fiddle