I am working with a ng-grid that displays data grouped by category. Here is the setup:
$scope.gridOptions = {
columnDefs: [
{field: 'cat', displayName: 'Category'},
{field: 'name', displayName: 'Name'},
{field: 'val', displayName: 'Value'}
],
data: 'myData',
groups: ['cat']
}
My goal is to un-group the data in the ng-grid using an external button. I do not want to show the group panel (using
$scope.gridOptions.showGroupPanel: true
), which has an 'X' button to clear the grouping.
I have attempted the following methods upon clicking the external button, but they did not work:
$scope.gridOptions.groups = [];
$scope.gridOptions.groups.length = 0
If you have any suggestions on how I can remove the grouping, please let me know. Ideally, I would like to toggle the grouping on/off with the button. Thank you for your assistance!
For reference, here is a Fiddle