ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Any Way to allow only one group to be expanded at a time

Open russgove opened this issue 12 years ago • 4 comments

I have a grid with one level of grouping. Is there any way I can make it so that only one group is expanded at a time?

I overrode the toggleExpanded method in my aggregate method: aggregateTemplate: "<div ng-click="customExpand(row)" ng-style="rowStyle(row)" class="ngAggregate">\r"

But now in my customExpand method, How do I get at all the other groups , so that I can collapse them? $scope.customExpand = function (row) { // first collapse all others... but HOW?

        row.toggleExpand();
    }

russgove avatar Jul 25 '14 22:07 russgove

I goy it working http://yetanothersharepointblog.wordpress.com/2014/08/05/making-angular-ng-grid-expand-only-one-group/

russgove avatar Aug 05 '14 10:08 russgove

Great, thanks for documenting this!

c0bra avatar Aug 05 '14 14:08 c0bra

Overwrite main functionality to making angular UI Grid force to expand only one row at a time when expand/collapse bottom clicked..

`toggleRowExpansion: function (rowEntity) { // COMMENT THIS LINES: // var row = grid.getRow(rowEntity); // if (row !== null) { // service.toggleRowExpansion(grid, row); // }

// ADD THIS LINES: var row = grid.getRow(rowEntity); if (row !== null) { var isRowExpanded = row.isExpanded || false; service.collapseAllRows(grid); if(!isRowExpanded) service.toggleRowExpansion(grid, row); } }`

Ashrafik avatar Sep 21 '16 12:09 Ashrafik

How can we achieve this functionallity in v4.0.7.

csaicharan avatar Oct 11 '17 10:10 csaicharan