Skip to content

Commit b1373de

Browse files
authored
Update table docs
1 parent b1713bd commit b1373de

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

src/table/table.component.ts

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -143,30 +143,21 @@ import { I18n } from "./../i18n/i18n.module";
143143
* }
144144
*
145145
* protected prepareData(data: Array<Array<any>>) {
146-
* // create new data from the service data
147-
* const newData: Array<Array<TableItem>> = [];
148-
* data.forEach(dataRow => {
149-
* const row: Array<TableItem> = [];
150-
* dataRow.forEach(dataElement => {
151-
* let template;
152-
* if (dataElement.template) {
153-
* template = dataElement.template;
154-
* } else if (typeof dataElement === 'string') {
155-
* template = undefined;
156-
* } else {
157-
* template = this.paginationTableItemTemplate;
158-
* }
159-
*
160-
* row.push(
161-
* new TableItem({
162-
* data: dataElement.data,
163-
* template: template
164-
* })
165-
* );
166-
* });
167-
* newData.push(row);
168-
* });
169-
* return newData;
146+
* // create new data from the service data
147+
* let newData = [];
148+
* data.forEach(dataRow => {
149+
* let row = [];
150+
* dataRow.forEach(dataElement => {
151+
* row.push(new TableItem({
152+
* data: dataElement,
153+
* template: typeof dataElement === "string" ? undefined : this.paginationTableItemTemplate
154+
* // your template can handle all the data types so you don't have to conditionally set it
155+
* // you can also set different templates for different columns based on index
156+
* }));
157+
* });
158+
* newData.push(row);
159+
* });
160+
* return newData;
170161
* }
171162
* ```
172163
*

0 commit comments

Comments
 (0)