Good afternoon! I'm working with a data grid widget with grouping enabled. My grid looks great with the part numbers expanded and all the detail rows showing under each part. I would like to set up buttons to allow users to collapse all groups or expand all groups. I know Pivot Grids have app variables I can set, but I can't seem to find something like that for regular grids.
Announcement
Collapse
No announcement yet.
Expand or Collapse All Groups - Data Grid
Collapse
X
-
I'm not sure what the type would be here. To do this with pivot grids I could do:
var thisGrid = getWidget('widgetNum');
thisGrid.down('pivotgrid').collapseAll();
success();
I tried looking at https://examples.sencha.com/extjs/7..../#grouped-grid but I'm a little lost here.
Comment
-
Hi,
This one isn't as straight forward so it will be good to have it as an app variable in 6.1
Below is an example script and I named my widget myWidget and this will collapseAll however if you want to expandAll just change the value of the fnc variable to 'expandAll'
Code:var myWidget = getWidget('myWidget'), grid = myWidget.down('grid'), view = grid.getView(), features = (view.features) ? view.features : [], fnc = 'collapseAll', // or could be 'expandAll' grouping, ii; // get the grouping feature // for (var ii = 0; ii < features.length; ii++) { if (features[ii].ftype === 'grouping' || features[ii].ftype === 'groupingsummary') { grouping = features[ii]; break; } } // if grouping feature found then collapseAll/expandAll based on // the value of fnc // if (!Valence.isEmpty(grouping) && typeof grouping[fnc] === 'function') { grouping[fnc](); } success();
Comment
Comment