Skip to content

Commit 9fb0765

Browse files
andrewkittredgemportuga
authored andcommitted
feature(disableRowExpandable): Toggle subGrid controll visbility (#6135)
Set a 'disableRowExpandable' property on the subGridOptions object to controll the visibilty of the + icon for toggling the subGridVisiblity.
1 parent 1b85586 commit 9fb0765

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

misc/tutorial/216_expandable_grid.ngdoc

+30
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,32 @@ appears when you quickly scroll through the grid.
147147
$scope.gridOptions.data = data;
148148
});
149149
}]);
150+
app.controller('FourthCtrl', ['$scope', '$http', '$log', function ($scope, $http, $log) {
151+
$scope.gridOptions = {
152+
enableRowSelection: true,
153+
expandableRowTemplate: 'expandableRowTemplate.html',
154+
expandableRowHeight: 150
155+
}
156+
157+
$scope.gridOptions.columnDefs = [
158+
{ name: 'id', pinnedLeft:true },
159+
{ name: 'name'},
160+
{ name: 'age'},
161+
{ name: 'address.city'}
162+
];
163+
164+
$http.get('/data/500_complex.json')
165+
.success(function(data) {
166+
for(i = 0; i < data.length; i++){
167+
data[i].subGridOptions = {
168+
columnDefs: [ {name:"Id", field:"id"},{name:"Name", field:"name"} ],
169+
data: data[i].friends,
170+
disableRowExpandable : (i % 2 === 0)
171+
}
172+
}
173+
$scope.gridOptions.data = data;
174+
});
175+
}]);
150176
</file>
151177
<file name="index.html">
152178
<div ng-controller="MainCtrl">
@@ -164,6 +190,10 @@ appears when you quickly scroll through the grid.
164190
<div ng-controller="ThirdCtrl">
165191
<div ui-grid="gridOptions" ui-grid-expandable class="grid"></div>
166192
</div>
193+
Toggle expand subGrid control
194+
<div ng-controller="FourthCtrl">
195+
<div ui-grid="gridOptions" ui-grid-expandable class="grid"></div>
196+
</div>
167197
</file>
168198
<file name="main.css">
169199
.grid {

src/features/expandable/templates/expandableRowHeader.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
class="ui-grid-row-header-cell ui-grid-expandable-buttons-cell">
33
<div
44
class="ui-grid-cell-contents">
5-
<i ng-if="!row.groupHeader==true"
5+
<i ng-if="!(row.groupHeader==true || row.entity.subGridOptions.disableRowExpandable)"
66
ng-class="{ 'ui-grid-icon-plus-squared' : !row.isExpanded, 'ui-grid-icon-minus-squared' : row.isExpanded }"
77
ng-click="grid.api.expandable.toggleRowExpansion(row.entity)">
88
</i>

0 commit comments

Comments
 (0)