Skip to content

Commit 47069f4

Browse files
daniel-gwilt-softwaremportuga
authored andcommitted
fix (expandable) expand all opens disableRowExpandable rows (#6442)
* fix (expandable) expand all opens disableRowExpandable rows Resolved issue where clicking the "expand all" button opens sub grids that have disableRowExpandable set to true. This leads to seeing ugly empty sub grid white space. The fix simply includes a check for each row to see if expansion is disabled or not. * fix (expandable) update to tests to handle expansion only in enabled rows Tests expected all rows to be expanded when "toggle all" and "expand all" function are called. This is not correct if a row's expansion has been turned off.
1 parent 7dbf395 commit 47069f4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/features/expandable/js/expandable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@
265265

266266
expandAllRows: function(grid, $scope) {
267267
grid.renderContainers.body.visibleRowCache.forEach( function(row) {
268-
if (!row.isExpanded) {
268+
if (!row.isExpanded && !(row.entity.subGridOptions && row.entity.subGridOptions.disableRowExpandable)) {
269269
service.toggleRowExpansion(grid, row);
270270
}
271271
});

src/features/expandable/test/expandable.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('ui.grid.expandable', function () {
4545
it('expandAll and collapseAll should set and unset row.isExpanded', function () {
4646
scope.gridApi.expandable.expandAllRows();
4747
scope.grid.rows.forEach(function(row) {
48-
expect(row.isExpanded).toBe(true);
48+
expect(row.isExpanded || (row.entity.subGridOptions && row.entity.subGridOptions.disableRowExpandable)).toBe(true);
4949
});
5050
scope.gridApi.expandable.collapseAllRows();
5151
scope.grid.rows.forEach(function(row) {
@@ -56,7 +56,7 @@ describe('ui.grid.expandable', function () {
5656
it('toggleAllRows should set and unset row.isExpanded', function(){
5757
scope.gridApi.expandable.toggleAllRows();
5858
scope.grid.rows.forEach(function(row){
59-
expect(row.isExpanded).toBe(true);
59+
expect(row.isExpanded || (row.entity.subGridOptions && row.entity.subGridOptions.disableRowExpandable)).toBe(true);
6060
});
6161
scope.gridApi.expandable.toggleAllRows();
6262
scope.grid.rows.forEach(function(row){

0 commit comments

Comments
 (0)