From 3eb00a2f8354e52a68447882e156dab50fcc9025 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Tue, 20 Sep 2016 13:53:35 +0100 Subject: [PATCH] use sort feature --- .../activiti/activiti-demo.component.html | 4 +-- .../activiti/activiti-demo.component.ts | 31 ++++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html index d326066c7c..382a4ec4cf 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html @@ -24,7 +24,7 @@
Task List -
@@ -49,7 +49,7 @@
Process List -
diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts index 202cf792d5..08e487dabd 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts @@ -26,6 +26,10 @@ import { ACTIVITI_PROCESSLIST_DIRECTIVES } from 'ng2-activiti-processlist'; import { ActivitiForm } from 'ng2-activiti-form'; import { ActivatedRoute } from '@angular/router'; import { Subscription } from 'rxjs/Rx'; +import { + ObjectDataTableAdapter, + DataSorting +} from 'ng2-alfresco-datatable'; declare let __moduleName: string; declare var componentHandler; @@ -74,6 +78,9 @@ export class ActivitiDemoComponent implements AfterViewChecked { sub: Subscription; + dataTasks: ObjectDataTableAdapter; + dataProcesses: ObjectDataTableAdapter; + @Input() appId: number; @@ -90,13 +97,23 @@ export class ActivitiDemoComponent implements AfterViewChecked { } constructor(private route: ActivatedRoute) { - this.taskSchemaColumns = [ - {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true} - // {type: 'text', key: 'created', title: 'Created', sortable: true} - ]; - this.processSchemaColumns = [ - {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true} - ]; + this.dataTasks = new ObjectDataTableAdapter( + [], + [ + {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true}, + {type: 'text', key: 'created', title: 'Created', cssClass: 'hidden', sortable: true} + ] + ); + this.dataTasks.setSorting(new DataSorting('created', 'desc')); + + this.dataProcesses = new ObjectDataTableAdapter( + [], + [ + {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true}, + {type: 'text', key: 'started', title: 'Started', cssClass: 'hidden', sortable: true} + ] + ); + this.dataProcesses.setSorting(new DataSorting('started', 'desc')); } ngOnInit() {