mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#82 datatable api improvements
This commit is contained in:
@@ -3,8 +3,13 @@
|
||||
</div>
|
||||
<div class="p-10">
|
||||
<button
|
||||
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect"
|
||||
(click)="addRow()">
|
||||
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect"
|
||||
(click)="addRow()">
|
||||
Add row
|
||||
</button>
|
||||
<button
|
||||
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect"
|
||||
(click)="replaceRows()">
|
||||
Replace rows
|
||||
</button>
|
||||
</div>
|
||||
|
@@ -58,7 +58,7 @@ export class DataTableDemoComponent {
|
||||
]
|
||||
);
|
||||
|
||||
this.data.setSorting(new DataSorting('name', 'asc'));
|
||||
this.data.setSorting(new DataSorting('id', 'asc'));
|
||||
}
|
||||
|
||||
addRow() {
|
||||
@@ -72,4 +72,15 @@ export class DataTableDemoComponent {
|
||||
this.data.getRows().push(row);
|
||||
this.data.sort();
|
||||
}
|
||||
|
||||
replaceRows() {
|
||||
let objects = [
|
||||
{id: 10, name: 'Name 10', createdBy: this._createdBy, icon: 'material-icons://face'},
|
||||
{id: 11, name: 'Name 11', createdBy: this._createdBy, icon: 'material-icons://language'},
|
||||
{id: 12, name: 'Name 12', createdBy: this._createdBy, icon: 'material-icons://pets'},
|
||||
{id: 13, name: 'Image 13', createdBy: this._createdBy, icon: this._imageUrl}
|
||||
];
|
||||
let rows = objects.map(obj => new ObjectDataRow(obj));
|
||||
this.data.setRows(rows);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user