[ADF-3082] Task Filter - Custom Task filters don't work (#3402)

* [ADF-3082] Custom Task filters don't work.

* Added an sorting input to the datatable.
* Updated documentation for the recent changes.
* Added testcases for the recent changes.

* [ADF-3082] Custom Task filters don't work

* Added a sorting input to the datatable
* Added testcases to the recent changes.
* Updated doc for the recent changes.

* * Refactored task/process list dataSort.

* * Refactored process/task list datasort method
This commit is contained in:
siva kumar
2018-05-30 13:57:08 +05:30
committed by Maurizio Vitale
parent a11766aa23
commit 9eae0fcc8f
13 changed files with 144 additions and 11 deletions

View File

@@ -67,6 +67,12 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
@Input()
rows: any[] = [];
/** Define the sort order of the datatable. Possible values are :
* [`created`, `desc`], [`created`, `asc`], [`due`, `desc`], [`due`, `asc`]
*/
@Input()
sorting: any[] = [];
/** Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode,
* you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows.
*/
@@ -207,6 +213,10 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
this.resetSelection();
this.emitRowSelectionEvent('row-unselect', null);
}
if (this.isPropertyChanged(changes['sorting'])) {
this.setTableSorting(changes['sorting'].currentValue);
}
}
ngDoCheck() {
@@ -224,6 +234,12 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
return rows.map(row => new ObjectDataRow(row));
}
convertToDataSorting(sorting: any[]): DataSorting {
if (sorting && sorting.length > 0) {
return new DataSorting(sorting[0], sorting[1]);
}
}
private initAndSubscribeClickStream() {
this.unsubscribeClickStream();
let singleClickStream = this.click$
@@ -300,6 +316,12 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
}
}
private setTableSorting(sorting) {
if (this.data) {
this.data.setSorting(this.convertToDataSorting(sorting));
}
}
onRowClick(row: DataRow, e: MouseEvent) {
if (e) {
e.preventDefault();