mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
#82 replace columns demo for datatable
This commit is contained in:
@@ -12,4 +12,9 @@
|
|||||||
(click)="replaceRows()">
|
(click)="replaceRows()">
|
||||||
Replace rows
|
Replace rows
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect"
|
||||||
|
(click)="replaceColumns()">
|
||||||
|
Replace columns
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -21,7 +21,8 @@ import {
|
|||||||
ALFRESCO_DATATABLE_DIRECTIVES,
|
ALFRESCO_DATATABLE_DIRECTIVES,
|
||||||
ObjectDataTableAdapter,
|
ObjectDataTableAdapter,
|
||||||
DataSorting,
|
DataSorting,
|
||||||
ObjectDataRow
|
ObjectDataRow,
|
||||||
|
ObjectDataColumn
|
||||||
} from 'ng2-alfresco-datatable/ng2-alfresco-datatable';
|
} from 'ng2-alfresco-datatable/ng2-alfresco-datatable';
|
||||||
|
|
||||||
declare let __moduleName: string;
|
declare let __moduleName: string;
|
||||||
@@ -83,4 +84,13 @@ export class DataTableDemoComponent {
|
|||||||
let rows = objects.map(obj => new ObjectDataRow(obj));
|
let rows = objects.map(obj => new ObjectDataRow(obj));
|
||||||
this.data.setRows(rows);
|
this.data.setRows(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
replaceColumns() {
|
||||||
|
let schema = [
|
||||||
|
{ type: 'text', key: 'id', sortable: true },
|
||||||
|
{ type: 'text', key: 'name', sortable: true }
|
||||||
|
];
|
||||||
|
let columns = schema.map(col => new ObjectDataColumn(col));
|
||||||
|
this.data.setColumns(columns);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user