[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

@@ -1,6 +1,7 @@
<div>
<adf-datatable #dataTable
[data]="data"
[sorting]="dataSort"
[loading]="isLoading"
[selectionMode]="selectionMode"
[multiselect]="multiselect"

View File

@@ -251,6 +251,12 @@ describe('ProcessInstanceListComponent', () => {
expect(component.getCurrentId()).toBeNull();
});
it('should return the sorting order if sort is defined', () => {
component.sort = 'fakeKey-fakeOrder';
fixture.detectChanges();
expect(component.dataSort).toEqual(['fakeKey', 'fakeOrder']);
});
it('should return selected true for the selected process', () => {
component.data = new ObjectDataTableAdapter(
[

View File

@@ -131,6 +131,7 @@ export class ProcessInstanceListComponent implements OnChanges, AfterContentInit
currentInstanceId: string;
isLoading: boolean = true;
layoutPresets = {};
sorting: any[] = ['created', 'desc'];
pagination: BehaviorSubject<PaginationModel>;
@@ -289,6 +290,14 @@ export class ProcessInstanceListComponent implements OnChanges, AfterContentInit
}
}
/**
* Sort the process based on current value of 'sort' property
* Return the sorting order
*/
get dataSort(): any[] {
return this.sort ? this.sort.split('-') : this.sorting;
}
/**
* Return the current id
*/

View File

@@ -3,6 +3,7 @@
<div>
<adf-datatable
[data]="data"
[sorting]="dataSort"
[loading]="isLoading"
[multiselect]="multiselect"
[selectionMode]="selectionMode"

View File

@@ -334,6 +334,12 @@ describe('TaskListComponent', () => {
expect(component.getCurrentId()).toBeNull();
});
it('should return the sorting order if sort is defined', () => {
component.sort = 'fakeKey-fakeOrder';
fixture.detectChanges();
expect(component.dataSort).toEqual(['fakeKey', 'fakeOrder']);
});
it('should return selected true for the selected task', () => {
component.data = new ObjectDataTableAdapter(
[

View File

@@ -136,6 +136,7 @@ export class TaskListComponent implements OnChanges, AfterContentInit, Paginated
size: number = PaginationComponent.DEFAULT_PAGINATION.maxItems;
isLoading: boolean = true;
sorting: any[] = ['created', 'desc'];
/**
* Toggles custom data source mode.
@@ -301,6 +302,14 @@ export class TaskListComponent implements OnChanges, AfterContentInit, Paginated
}
}
/**
* Return the sorting order
* Sort the tasks based on current value of 'sort' property
*/
get dataSort(): any[] {
return this.sort ? this.sort.split('-') : this.sorting;
}
/**
* Return the current id
*/