* Updates the index-related context for each row to reflect any changes in the index of the rows, * e.g. first/last/even/odd.
()
| 1406 | * e.g. first/last/even/odd. |
| 1407 | */ |
| 1408 | private _updateRowIndexContext() { |
| 1409 | const viewContainer = this._rowOutlet.viewContainer; |
| 1410 | for (let renderIndex = 0, count = viewContainer.length; renderIndex < count; renderIndex++) { |
| 1411 | const viewRef = viewContainer.get(renderIndex) as RowViewRef<T>; |
| 1412 | const context = viewRef.context as RowContext<T>; |
| 1413 | context.count = count; |
| 1414 | context.first = renderIndex === 0; |
| 1415 | context.last = renderIndex === count - 1; |
| 1416 | context.even = renderIndex % 2 === 0; |
| 1417 | context.odd = !context.even; |
| 1418 | |
| 1419 | if (this.multiTemplateDataRows) { |
| 1420 | context.dataIndex = this._renderRows[renderIndex].dataIndex; |
| 1421 | context.renderIndex = renderIndex; |
| 1422 | } else { |
| 1423 | context.index = this._renderRows[renderIndex].dataIndex; |
| 1424 | } |
| 1425 | } |
| 1426 | } |
| 1427 | |
| 1428 | /** Gets the column definitions for the provided row def. */ |
| 1429 | private _getCellTemplates(rowDef: BaseRowDef): TemplateRef<any>[] { |