@@ -13,26 +13,26 @@ import { getScrollbarWidth } from "../common/utils";
1313/**
1414 * Build your table with this component by extending things that differ from default.
1515 *
16- * demo: [https://pages.github.ibm. com/peretz/neutrino/#/table ](https://pages.github.ibm. com/peretz/neutrino/#/table )
16+ * demo: [https://angular.carbondesignsystem. com/?selectedKind=Table ](https://angular.carbondesignsystem. com/?selectedKind=Table )
1717 *
1818 * Instead of the usual write-your-own-html approach you had with `<table>`,
19- * neutrino table uses model-view-controller approach.
19+ * carbon table uses model-view-controller approach.
2020 *
2121 * Here, you create a view (with built-in controller) and provide it a model.
2222 * Changes you make to the model are reflected in the view. Provide same model you use
23- * in the table to the `<ibm-table- pagination>` and `<ibm-table-goto-page >` components.
23+ * in the table to the `<ibm-pagination>` components.
2424 * They provide a different view over the same data.
2525 *
2626 * ## Basic usage
2727 *
2828 * ```html
29- * <ibm-table [model]="simpleModel "></ibm-table>
29+ * <ibm-table [model]="model "></ibm-table>
3030 * ```
3131 *
3232 * ```typescript
33- * public simpleModel = new TableModel();
33+ * public model = new TableModel();
3434 *
35- * this.simpleModel .data = [
35+ * this.model .data = [
3636 * [new TableItem({data: "asdf"}), new TableItem({data: "qwer"})],
3737 * [new TableItem({data: "csdf"}), new TableItem({data: "zwer"})],
3838 * [new TableItem({data: "bsdf"}), new TableItem({data: "swer"})],
@@ -102,14 +102,10 @@ import { getScrollbarWidth } from "../common/utils";
102102 *
103103 * See `TableHeaderItem` class for more information.
104104 *
105- * ## Build your own table footer with neutrino components
105+ * ## Use pagination as table footer
106106 *
107107 * ```html
108- * <p class="table-footer">
109- * <span class="table-selection-info">{{model.selectedRowsCount()}} of {{model.totalDataLength}} rows selected</span>
110- * <ibm-table-pagination [model]="model" (selectPage)="selectPage($event)"></ibm-table-pagination>
111- * <ibm-table-goto-page (selectPage)="selectPage($event)"></ibm-table-goto-page>
112- * </p>
108+ * <ibm-pagination [model]="model" (selectPage)="selectPage($event)"></ibm-pagination>
113109 * ```
114110 *
115111 * `selectPage()` function should fetch the data from backend, create new `data`, apply it to `model.data`,
@@ -119,28 +115,30 @@ import { getScrollbarWidth } from "../common/utils";
119115 *
120116 * ```typescript
121117 * selectPage(page) {
122- * this.service.getPage(page).then((data: Array<Array<any>>) => {
123- * let newData = [];
124- *
125- * // create new data from the service data
126- * data.forEach(dataRow => {
127- * let row = [];
128- * dataRow.forEach(dataElement => {
129- * row.push(new TableItem({
130- * data: dataElement,
131- * template: typeof dataElement === "string" ? undefined : this.customTableItemTemplate
132- * // your template can handle all the data types so you don't have to conditionally set it
133- * // you can also set different templates for different columns based on index
134- * }));
135- * });
136- * newData.push(row);
137- * });
138- *
118+ * this.getPage(page).then((data: Array<Array<any>>) => {
139119 * // set the data and update page
140- * this.model.data = newData ;
120+ * this.model.data = this.prepareData(data) ;
141121 * this.model.currentPage = page;
142122 * });
143123 * }
124+ *
125+ * private prepareData(data: Array<Array<any>>) {
126+ * // create new data from the service data
127+ * let newData = [];
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.paginationTableItemTemplate
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+ * return newData;
141+ * }
144142 * ```
145143 *
146144 * @export
@@ -162,9 +160,10 @@ import { getScrollbarWidth } from "../common/utils";
162160 <th *ngIf="model.hasExpandableRows()"></th>
163161 <th *ngIf="showSelectionColumn">
164162 <ibm-checkbox
165- [size]="size !== 'lg' ? 'sm' : 'md'"
163+ [size]="size !== ( 'lg' ? 'sm' : 'md') "
166164 [(ngModel)]="selectAllCheckbox"
167165 [indeterminate]="selectAllCheckboxSomeSelected"
166+ aria-label="Select all rows"
168167 (change)="onSelectAllCheckboxChange()">
169168 </ibm-checkbox>
170169 </th>
@@ -301,6 +300,7 @@ import { getScrollbarWidth } from "../common/utils";
301300 </td>
302301 <td *ngIf="showSelectionColumn">
303302 <ibm-checkbox
303+ aria-label="Select row"
304304 [size]="size !== ('lg' ? 'sm' : 'md')"
305305 [(ngModel)]="model.rowsSelected[i]"
306306 (change)="onRowCheckboxChange(i)">
@@ -383,7 +383,7 @@ export class Table {
383383 /**
384384 * Controls whether to show the selection checkboxes column or not.
385385 *
386- * @deprecated in the next major neutrino version in favour of
386+ * @deprecated in the next major carbon-components-angular version in favour of
387387 * `showSelectionColumn` because of new attribute `enableSingleSelect`
388388 * please use `showSelectionColumn` instead
389389 */
0 commit comments