Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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