Skip to content

Commit 6cd5f8d

Browse files
committed
Doco(317 templates): fix #1663 example of merged cells
1 parent eabff1e commit 6cd5f8d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

misc/tutorial/317_custom_templates.ngdoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ In this example we create a grid almost the same as the most basic one, but with
1515
with a cellTemplate that totals all the items above it in the grid. This template continues to work when the data is
1616
filtered or sorted.
1717

18+
The custom row template merges all the cells together when the entity.merge value is true.
19+
1820
You can use [grid.appScope](/docs/#/tutorial/305_appScope) in your row template to access
1921
elements in your controller's scope. More details are on
2022
the [scopes](/docs/#/tutorial/305_appScope) tutorial.
@@ -40,7 +42,8 @@ In the cellTemplate you have access to `grid`, `row` and `column`, which allows
4042
$interval.cancel(sec);
4143
$scope.wait = '';
4244
return '<div ng-class="{ \'my-css-class\': grid.appScope.rowFormatter( row ) }">' +
43-
' <div ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ng-class="{ \'ui-grid-row-header-cell\': col.isRowHeader }" ui-grid-cell></div>' +
45+
' <div ng-if="row.entity.merge">{{row.entity.title}}</div>' +
46+
' <div ng-if="!row.entity.merge" ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ng-class="{ \'ui-grid-row-header-cell\': col.isRowHeader }" ui-grid-cell></div>' +
4447
'</div>';
4548
}, 6000);
4649
}
@@ -57,6 +60,10 @@ In the cellTemplate you have access to `grid`, `row` and `column`, which allows
5760
data.forEach( function(row, index) {
5861
row.widgets = index % 10;
5962
});
63+
data[1].merge = true;
64+
data[1].title = "A merged row";
65+
data[4].merge = true;
66+
data[4].title = "Another merged row";
6067
$scope.data = data;
6168
});
6269

0 commit comments

Comments
 (0)