Skip to content

Commit

Permalink
feature(disableRowExpandable): Toggle subGrid controll visbility (#6135)
Browse files Browse the repository at this point in the history
Set a 'disableRowExpandable' property on the subGridOptions object to
controll the visibilty of the + icon for toggling the subGridVisiblity.
  • Loading branch information
andrewkittredge authored and mportuga committed Jun 6, 2017
1 parent 1b85586 commit 9fb0765
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions misc/tutorial/216_expandable_grid.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,32 @@ appears when you quickly scroll through the grid.
$scope.gridOptions.data = data;
});
}]);
app.controller('FourthCtrl', ['$scope', '$http', '$log', function ($scope, $http, $log) {
$scope.gridOptions = {
enableRowSelection: true,
expandableRowTemplate: 'expandableRowTemplate.html',
expandableRowHeight: 150
}

$scope.gridOptions.columnDefs = [
{ name: 'id', pinnedLeft:true },
{ name: 'name'},
{ name: 'age'},
{ name: 'address.city'}
];

$http.get('/data/500_complex.json')
.success(function(data) {
for(i = 0; i < data.length; i++){
data[i].subGridOptions = {
columnDefs: [ {name:"Id", field:"id"},{name:"Name", field:"name"} ],
data: data[i].friends,
disableRowExpandable : (i % 2 === 0)
}
}
$scope.gridOptions.data = data;
});
}]);
</file>
<file name="index.html">
<div ng-controller="MainCtrl">
Expand All @@ -164,6 +190,10 @@ appears when you quickly scroll through the grid.
<div ng-controller="ThirdCtrl">
<div ui-grid="gridOptions" ui-grid-expandable class="grid"></div>
</div>
Toggle expand subGrid control
<div ng-controller="FourthCtrl">
<div ui-grid="gridOptions" ui-grid-expandable class="grid"></div>
</div>
</file>
<file name="main.css">
.grid {
Expand Down
2 changes: 1 addition & 1 deletion src/features/expandable/templates/expandableRowHeader.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class="ui-grid-row-header-cell ui-grid-expandable-buttons-cell">
<div
class="ui-grid-cell-contents">
<i ng-if="!row.groupHeader==true"
<i ng-if="!(row.groupHeader==true || row.entity.subGridOptions.disableRowExpandable)"
ng-class="{ 'ui-grid-icon-plus-squared' : !row.isExpanded, 'ui-grid-icon-minus-squared' : row.isExpanded }"
ng-click="grid.api.expandable.toggleRowExpansion(row.entity)">
</i>
Expand Down

0 comments on commit 9fb0765

Please sign in to comment.