mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#82 datatable project cleanup
basic implementation of main features: - custom data sources - column types - sorting by columns - click events
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
@@ -20,7 +20,7 @@ import {TranslatePipe} from 'ng2-translate/ng2-translate';
|
||||
|
||||
import {
|
||||
ALFRESCO_DATATABLE_DIRECTIVES,
|
||||
ALFRESCO_DATATABLE_PROVIDERS
|
||||
ObjectDataTableAdapter, DataSorting
|
||||
} from 'ng2-alfresco-datatable/ng2-alfresco-datatable';
|
||||
|
||||
declare let __moduleName:string;
|
||||
@@ -30,9 +30,34 @@ declare let __moduleName:string;
|
||||
selector: 'datatable-demo',
|
||||
templateUrl: './datatable-demo.component.html',
|
||||
directives: [ALFRESCO_DATATABLE_DIRECTIVES],
|
||||
providers: [ALFRESCO_DATATABLE_PROVIDERS],
|
||||
pipes: [TranslatePipe]
|
||||
})
|
||||
export class DataTableDemoComponent {
|
||||
|
||||
data: ObjectDataTableAdapter;
|
||||
|
||||
constructor() {
|
||||
|
||||
let imageUrl = 'http://placehold.it/140x100';
|
||||
let createdBy = {
|
||||
name: 'Denys Vuika',
|
||||
email: 'denys.vuika@alfresco.com'
|
||||
};
|
||||
|
||||
this.data = new ObjectDataTableAdapter(
|
||||
[
|
||||
{ id: 1, name: 'Name 1', createdBy: createdBy, icon: 'material-icons://folder_open' },
|
||||
{ id: 2, name: 'Name 2', createdBy: createdBy, icon: 'material-icons://accessibility' },
|
||||
{ id: 3, name: 'Name 3', createdBy: createdBy, icon: 'material-icons://alarm' },
|
||||
{ id: 4, name: 'Image 1', createdBy: createdBy, icon: imageUrl }
|
||||
],
|
||||
[
|
||||
{ type: 'image', key: 'icon', title: '', srTitle: 'Thumbnail' },
|
||||
{ type: 'text', key: 'id', title: 'Id', sortable: true},
|
||||
{ type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true },
|
||||
{ type: 'text', key: 'createdBy.name', title: 'Created By', sortable: true }
|
||||
]
|
||||
);
|
||||
|
||||
this.data.setSorting(new DataSorting('name', 'asc'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user