[ACA-3672] - added server order for document -list (#5899)

* [ACA-3672] - added sorting server side for document-list

* [ACA-3672] - added and fixed unit tests for backend order

* [ACA-3672] - fixed failing test

* [ACA-3672] - regenerated doc and renamed variable

Co-authored-by: Vito Albano <vitoalbano@Vitos-MacBook-Pro.local>
This commit is contained in:
Vito
2020-07-23 14:04:05 +01:00
committed by GitHub
parent a5972e753a
commit 30c5c58d40
57 changed files with 132 additions and 81 deletions

View File

@@ -279,7 +279,7 @@ describe('DataTable', () => {
});
it('should emit "sorting-changed" DOM event', (done) => {
const column = new ObjectDataColumn({ key: 'name', sortable: true, direction: 'asc' });
const column = new ObjectDataColumn({ key: 'name', sortable: true, direction: 'asc', sortingKey: 'displayName' });
dataTable.data = new ObjectDataTableAdapter(
[
{ name: '1' },
@@ -290,7 +290,7 @@ describe('DataTable', () => {
dataTable.data.setSorting(new DataSorting('name', 'desc'));
fixture.nativeElement.addEventListener('sorting-changed', (event: CustomEvent) => {
expect(event.detail.key).toBe('name');
expect(event.detail.key).toBe('displayName');
expect(event.detail.direction).toBe('asc');
done();
});

View File

@@ -547,7 +547,7 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
}
this.sorting = [column.key, newDirection];
this.data.setSorting(new DataSorting(column.key, newDirection));
this.emitSortingChangedEvent(column.key, newDirection);
this.emitSortingChangedEvent(column.sortingKey, newDirection);
}
this.keyManager.updateActiveItem(0);

View File

@@ -42,4 +42,5 @@ export interface DataColumn {
copyContent?: boolean;
editable?: boolean;
focus?: boolean;
sortingKey?: string;
}

View File

@@ -31,6 +31,7 @@ export class ObjectDataColumn implements DataColumn {
template?: TemplateRef<any>;
copyContent?: boolean;
focus?: boolean;
sortingKey?: string;
constructor(input: any) {
this.key = input.key;
@@ -43,5 +44,6 @@ export class ObjectDataColumn implements DataColumn {
this.template = input.template;
this.copyContent = input.copyContent;
this.focus = input.focus;
this.sortingKey = input.sortingKey;
}
}