|
|
|
@ -217,10 +217,17 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa |
|
|
|
const routerQueryParams: PageQueryParam = this.route.snapshot.queryParams; |
|
|
|
|
|
|
|
let sortOrder: SortOrder = null; |
|
|
|
if (this.entitiesTableConfig.defaultSortOrder || routerQueryParams.hasOwnProperty('direction') || routerQueryParams.hasOwnProperty('property')) { |
|
|
|
if (this.pageMode) { |
|
|
|
if (this.entitiesTableConfig.defaultSortOrder || routerQueryParams.hasOwnProperty('direction') || routerQueryParams.hasOwnProperty('property')) { |
|
|
|
sortOrder = { |
|
|
|
property: routerQueryParams?.property || this.entitiesTableConfig.defaultSortOrder.property, |
|
|
|
direction: routerQueryParams?.direction || this.entitiesTableConfig.defaultSortOrder.direction |
|
|
|
}; |
|
|
|
} |
|
|
|
} else if (this.entitiesTableConfig.defaultSortOrder){ |
|
|
|
sortOrder = { |
|
|
|
property: routerQueryParams?.property || this.entitiesTableConfig.defaultSortOrder.property, |
|
|
|
direction: routerQueryParams?.direction || this.entitiesTableConfig.defaultSortOrder.direction |
|
|
|
property: this.entitiesTableConfig.defaultSortOrder.property, |
|
|
|
direction: this.entitiesTableConfig.defaultSortOrder.direction |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
@ -238,15 +245,17 @@ export class EntitiesTableComponent extends PageComponent implements IEntitiesTa |
|
|
|
this.pageLink = new PageLink(10, 0, null, sortOrder); |
|
|
|
} |
|
|
|
this.pageLink.pageSize = this.displayPagination ? this.defaultPageSize : MAX_SAFE_PAGE_SIZE; |
|
|
|
if (routerQueryParams.hasOwnProperty('page')) { |
|
|
|
this.pageLink.page = Number(routerQueryParams.page); |
|
|
|
} |
|
|
|
if (routerQueryParams.hasOwnProperty('pageSize')) { |
|
|
|
this.pageLink.pageSize = Number(routerQueryParams.pageSize); |
|
|
|
} |
|
|
|
if (routerQueryParams.hasOwnProperty('textSearch') && !isEmptyStr(routerQueryParams.textSearch)) { |
|
|
|
this.textSearchMode = true; |
|
|
|
this.pageLink.textSearch = decodeURI(routerQueryParams.textSearch); |
|
|
|
if (this.pageMode) { |
|
|
|
if (routerQueryParams.hasOwnProperty('page')) { |
|
|
|
this.pageLink.page = Number(routerQueryParams.page); |
|
|
|
} |
|
|
|
if (routerQueryParams.hasOwnProperty('pageSize')) { |
|
|
|
this.pageLink.pageSize = Number(routerQueryParams.pageSize); |
|
|
|
} |
|
|
|
if (routerQueryParams.hasOwnProperty('textSearch') && !isEmptyStr(routerQueryParams.textSearch)) { |
|
|
|
this.textSearchMode = true; |
|
|
|
this.pageLink.textSearch = decodeURI(routerQueryParams.textSearch); |
|
|
|
} |
|
|
|
} |
|
|
|
this.dataSource = this.entitiesTableConfig.dataSource(this.dataLoaded.bind(this)); |
|
|
|
if (this.entitiesTableConfig.onLoadAction) { |
|
|
|
|