* Updates the index-related context for each row to reflect any changes in the index of the rows, * e.g. first/last/even/odd.
()
| 1388 | * e.g. first/last/even/odd. |
| 1389 | */ |
| 1390 | private _updateRowIndexContext() { |
| 1391 | const viewContainer = this._rowOutlet.viewContainer; |
| 1392 | for (let renderIndex = 0, count = viewContainer.length; renderIndex < count; renderIndex++) { |
| 1393 | const viewRef = viewContainer.get(renderIndex) as RowViewRef<T>; |
| 1394 | const context = viewRef.context as RowContext<T>; |
| 1395 | context.count = count; |
| 1396 | context.first = renderIndex === 0; |
| 1397 | context.last = renderIndex === count - 1; |
| 1398 | context.even = renderIndex % 2 === 0; |
| 1399 | context.odd = !context.even; |
| 1400 | |
| 1401 | if (this.multiTemplateDataRows) { |
| 1402 | context.dataIndex = this._renderRows[renderIndex].dataIndex; |
| 1403 | context.renderIndex = renderIndex; |
| 1404 | } else { |
| 1405 | context.index = this._renderRows[renderIndex].dataIndex; |
| 1406 | } |
| 1407 | } |
| 1408 | } |
| 1409 | |
| 1410 | /** Gets the column definitions for the provided row def. */ |
| 1411 | private _getCellTemplates(rowDef: BaseRowDef): TemplateRef<any>[] { |