Skip to content

Commit

Permalink
fix (expandable) expand all opens disableRowExpandable rows (#6442)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
daniel-gwilt-software authored and mportuga committed Nov 6, 2017
1 parent 7dbf395 commit 47069f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/features/expandable/js/expandable.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@

expandAllRows: function(grid, $scope) {
grid.renderContainers.body.visibleRowCache.forEach( function(row) {
if (!row.isExpanded) {
if (!row.isExpanded && !(row.entity.subGridOptions && row.entity.subGridOptions.disableRowExpandable)) {
service.toggleRowExpansion(grid, row);
}
});
Expand Down
4 changes: 2 additions & 2 deletions src/features/expandable/test/expandable.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('ui.grid.expandable', function () {
it('expandAll and collapseAll should set and unset row.isExpanded', function () {
scope.gridApi.expandable.expandAllRows();
scope.grid.rows.forEach(function(row) {
expect(row.isExpanded).toBe(true);
expect(row.isExpanded || (row.entity.subGridOptions && row.entity.subGridOptions.disableRowExpandable)).toBe(true);
});
scope.gridApi.expandable.collapseAllRows();
scope.grid.rows.forEach(function(row) {
Expand All @@ -56,7 +56,7 @@ describe('ui.grid.expandable', function () {
it('toggleAllRows should set and unset row.isExpanded', function(){
scope.gridApi.expandable.toggleAllRows();
scope.grid.rows.forEach(function(row){
expect(row.isExpanded).toBe(true);
expect(row.isExpanded || (row.entity.subGridOptions && row.entity.subGridOptions.disableRowExpandable)).toBe(true);
});
scope.gridApi.expandable.toggleAllRows();
scope.grid.rows.forEach(function(row){
Expand Down

0 comments on commit 47069f4

Please sign in to comment.