perspective sort - divided by table

This commit is contained in:
Jan Prochazka
2022-07-31 12:22:13 +02:00
parent 452dba7f32
commit 44668b8017
3 changed files with 23 additions and 27 deletions

View File

@@ -7,9 +7,11 @@ export interface PerspectiveConfigColumns {
export interface PerspectiveConfig extends PerspectiveConfigColumns {
filters: { [uniqueName: string]: string };
sort: {
uniqueName: string;
order: 'ASC' | 'DESC';
}[];
[parentUniqueName: string]: {
uniqueName: string;
order: 'ASC' | 'DESC';
}[];
};
}
export function createPerspectiveConfig(): PerspectiveConfig {
@@ -18,7 +20,7 @@ export function createPerspectiveConfig(): PerspectiveConfig {
checkedColumns: [],
uncheckedColumns: [],
filters: {},
sort: [],
sort: {},
};
}

View File

@@ -188,7 +188,7 @@ export abstract class PerspectiveTreeNode {
getOrderBy(table: TableInfo): PerspectiveDataLoadProps['orderBy'] {
const res = _compact(
this.childNodes.map(node => {
const sort = this.config?.sort?.find(x => x.uniqueName == node.uniqueName);
const sort = this.config?.sort?.[node?.parentNode?.uniqueName]?.find(x => x.uniqueName == node.uniqueName);
if (sort) {
return {
columnName: node.columnName,