Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 80bba3e

Browse files
Ghislain BeaulacGhislain Beaulac
authored andcommitted
fix(preset): Preset was not working when using queryField
1 parent 46da5c2 commit 80bba3e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/app/modules/angular-slickgrid/services/graphql.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,13 +462,13 @@ export class GraphqlService implements BackendService {
462462
// orderBy:[{field: lastName, direction: ASC}, {field: firstName, direction: DESC}]
463463
if (sortColumns && sortColumns.length === 0) {
464464
graphqlSorters = new Array(this.defaultOrderBy); // when empty, use the default sort
465-
currentSorters = new Array({ columnId: this.defaultOrderBy.direction, direction: this.defaultOrderBy.direction });
465+
currentSorters = new Array({ columnId: this.defaultOrderBy.field, direction: this.defaultOrderBy.direction });
466466
} else {
467467
if (sortColumns) {
468468
for (const column of sortColumns) {
469469
if (column && column.sortCol) {
470470
currentSorters.push({
471-
columnId: (column.sortCol.queryField || column.sortCol.queryFieldSorter || column.sortCol.field || column.sortCol.id) + '',
471+
columnId: (column.sortCol.field || column.sortCol.id) + '',
472472
direction: column.sortAsc ? SortDirection.ASC : SortDirection.DESC
473473
});
474474

src/app/modules/angular-slickgrid/services/grid-odata.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,14 @@ export class GridOdataService implements BackendService {
349349
for (const column of sortColumns) {
350350
if (column.sortCol) {
351351
let fieldName = (column.sortCol.queryField || column.sortCol.queryFieldSorter || column.sortCol.field || column.sortCol.id) + '';
352+
let columnFieldName = (column.sortCol.field || column.sortCol.id) + '';
352353
if (this.odataService.options.caseType === CaseType.pascalCase) {
353354
fieldName = String.titleCase(fieldName);
355+
columnFieldName = String.titleCase(columnFieldName);
354356
}
355357

356358
sorterArray.push({
357-
columnId: fieldName,
359+
columnId: columnFieldName,
358360
direction: column.sortAsc ? 'asc' : 'desc'
359361
});
360362
}

0 commit comments

Comments
 (0)