Skip to content

Commit

Permalink
refactor(build): fix some TS Type warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Apr 12, 2020
1 parent e2f920b commit 57f6b8c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/services/filter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ export class FilterService {
delete treeObj[inputArray[i][dataViewIdIdentifier]].__used;
}

const filteredChildrenAndParents = [];
const filteredChildrenAndParents: any[] = [];
for (let i = 0; i < inputArray.length; i++) {
const item = inputArray[i];
let matchFilter = true; // valid until proven otherwise
Expand Down
18 changes: 12 additions & 6 deletions packages/common/src/services/sort.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,20 @@ export class SortService {
// first presort it once by tree level
const treeDataOptions = this._gridOptions.treeDataOptions;
const columnWithTreeData = this._columnDefinitions.find((col: Column) => col && col.id === treeDataOptions.columnId);
let sortTreeLevelColumn: ColumnSort = { columnId: treeDataOptions.columnId, sortCol: columnWithTreeData, sortAsc: true };
if (columnWithTreeData) {
let sortTreeLevelColumn: ColumnSort = { columnId: treeDataOptions.columnId, sortCol: columnWithTreeData, sortAsc: true };

// user could provide a custom sort field id, if so get that column and sort by it
if (treeDataOptions && treeDataOptions.sortByFieldId) {
const sortColumn = this._columnDefinitions.find((col: Column) => col.id === treeDataOptions.sortByFieldId);
sortTreeLevelColumn = { columnId: treeDataOptions.sortByFieldId, sortCol: sortColumn, sortAsc: true } as ColumnSort;
// user could provide a custom sort field id, if so get that column and sort by it
if (treeDataOptions && treeDataOptions.sortByFieldId) {
const sortColumn = this._columnDefinitions.find((col: Column) => col.id === treeDataOptions.sortByFieldId);
sortTreeLevelColumn = { columnId: treeDataOptions.sortByFieldId, sortCol: sortColumn, sortAsc: true } as ColumnSort;
}

// when we have a valid column with Tree Data, we can sort by that column
if (sortTreeLevelColumn && sortTreeLevelColumn.columnId) {
this.updateSorting([{ columnId: sortTreeLevelColumn.columnId || '', direction: SortDirection.asc }]);
}
}
this.updateSorting([{ columnId: sortTreeLevelColumn.columnId || '', direction: SortDirection.asc }]);
}
}

Expand Down

0 comments on commit 57f6b8c

Please sign in to comment.