@@ -15,26 +15,26 @@ const EN = require("./../i18n/en.json");
1515/**
1616 * Build your table with this component by extending things that differ from default.
1717 *
18- * demo: [https://pages.github.ibm. com/peretz/neutrino/#/table ](https://pages.github.ibm. com/peretz/neutrino/#/table )
18+ * demo: [https://angular.carbondesignsystem. com/?selectedKind=Table ](https://angular.carbondesignsystem. com/?selectedKind=Table )
1919 *
2020 * Instead of the usual write-your-own-html approach you had with `<table>`,
21- * neutrino table uses model-view-controller approach.
21+ * carbon table uses model-view-controller approach.
2222 *
2323 * Here, you create a view (with built-in controller) and provide it a model.
2424 * Changes you make to the model are reflected in the view. Provide same model you use
25- * in the table to the `<ibm-table- pagination>` and `<ibm-table-goto-page >` components.
25+ * in the table to the `<ibm-pagination>` components.
2626 * They provide a different view over the same data.
2727 *
2828 * ## Basic usage
2929 *
3030 * ```html
31- * <ibm-table [model]="simpleModel "></ibm-table>
31+ * <ibm-table [model]="model "></ibm-table>
3232 * ```
3333 *
3434 * ```typescript
35- * public simpleModel = new TableModel();
35+ * public model = new TableModel();
3636 *
37- * this.simpleModel .data = [
37+ * this.model .data = [
3838 * [new TableItem({data: "asdf"}), new TableItem({data: "qwer"})],
3939 * [new TableItem({data: "csdf"}), new TableItem({data: "zwer"})],
4040 * [new TableItem({data: "bsdf"}), new TableItem({data: "swer"})],
@@ -104,14 +104,10 @@ const EN = require("./../i18n/en.json");
104104 *
105105 * See `TableHeaderItem` class for more information.
106106 *
107- * ## Build your own table footer with neutrino components
107+ * ## Use pagination as table footer
108108 *
109109 * ```html
110- * <p class="table-footer">
111- * <span class="table-selection-info">{{model.selectedRowsCount()}} of {{model.totalDataLength}} rows selected</span>
112- * <ibm-table-pagination [model]="model" (selectPage)="selectPage($event)"></ibm-table-pagination>
113- * <ibm-table-goto-page (selectPage)="selectPage($event)"></ibm-table-goto-page>
114- * </p>
110+ * <ibm-pagination [model]="model" (selectPage)="selectPage($event)"></ibm-pagination>
115111 * ```
116112 *
117113 * `selectPage()` function should fetch the data from backend, create new `data`, apply it to `model.data`,
@@ -121,28 +117,30 @@ const EN = require("./../i18n/en.json");
121117 *
122118 * ```typescript
123119 * selectPage(page) {
124- * this.service.getPage(page).then((data: Array<Array<any>>) => {
125- * let newData = [];
126- *
127- * // create new data from the service data
128- * data.forEach(dataRow => {
129- * let row = [];
130- * dataRow.forEach(dataElement => {
131- * row.push(new TableItem({
132- * data: dataElement,
133- * template: typeof dataElement === "string" ? undefined : this.customTableItemTemplate
134- * // your template can handle all the data types so you don't have to conditionally set it
135- * // you can also set different templates for different columns based on index
136- * }));
137- * });
138- * newData.push(row);
139- * });
140- *
120+ * this.getPage(page).then((data: Array<Array<any>>) => {
141121 * // set the data and update page
142- * this.model.data = newData ;
122+ * this.model.data = this.prepareData(data) ;
143123 * this.model.currentPage = page;
144124 * });
145125 * }
126+ *
127+ * private prepareData(data: Array<Array<any>>) {
128+ * // create new data from the service data
129+ * let newData = [];
130+ * data.forEach(dataRow => {
131+ * let row = [];
132+ * dataRow.forEach(dataElement => {
133+ * row.push(new TableItem({
134+ * data: dataElement,
135+ * template: typeof dataElement === "string" ? undefined : this.paginationTableItemTemplate
136+ * // your template can handle all the data types so you don't have to conditionally set it
137+ * // you can also set different templates for different columns based on index
138+ * }));
139+ * });
140+ * newData.push(row);
141+ * });
142+ * return newData;
143+ * }
146144 * ```
147145 *
148146 * @export
@@ -164,9 +162,10 @@ const EN = require("./../i18n/en.json");
164162 <th *ngIf="model.hasExpandableRows()"></th>
165163 <th *ngIf="showSelectionColumn">
166164 <ibm-checkbox
167- [size]="size !== 'lg' ? 'sm' : 'md'"
165+ [size]="size !== ( 'lg' ? 'sm' : 'md') "
168166 [(ngModel)]="selectAllCheckbox"
169167 [indeterminate]="selectAllCheckboxSomeSelected"
168+ aria-label="Select all rows"
170169 (change)="onSelectAllCheckboxChange()">
171170 </ibm-checkbox>
172171 </th>
@@ -303,6 +302,7 @@ const EN = require("./../i18n/en.json");
303302 </td>
304303 <td *ngIf="showSelectionColumn">
305304 <ibm-checkbox
305+ aria-label="Select row"
306306 [size]="size !== ('lg' ? 'sm' : 'md')"
307307 [(ngModel)]="model.rowsSelected[i]"
308308 (change)="onRowCheckboxChange(i)">
@@ -387,7 +387,7 @@ export class Table {
387387 /**
388388 * Controls whether to show the selection checkboxes column or not.
389389 *
390- * @deprecated in the next major neutrino version in favour of
390+ * @deprecated in the next major carbon-components-angular version in favour of
391391 * `showSelectionColumn` because of new attribute `enableSingleSelect`
392392 * please use `showSelectionColumn` instead
393393 */
0 commit comments