Skip to content

Commit

Permalink
fix: review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tshimber committed Aug 28, 2024
1 parent d2a8e3e commit 302559b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/components/src/components/data-grid/data-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export class DataGrid {
}
this.parseRows();
this.setInitialRowProps();
this.presortIfNeeded();
this.presortTable();
this.dataNeedsCheck = true;
// Set flag to dirty to redo column width with new data
this.needsAutoWidthParse = true;
Expand Down Expand Up @@ -429,12 +429,6 @@ export class DataGrid {
this.sortTable(newSortDirection, type, columnIndex);
}

presortTable(sortDirection, columnIndex, type): void {
this.activeSortingIndex = columnIndex;
this.fields[columnIndex].sortDirection = sortDirection;
this.sortTable(sortDirection, type, columnIndex);
}

sortTable(sortDirection, type, columnIndex) {
const format = this.fields[columnIndex].format;
if (sortDirection === 'none') {
Expand Down Expand Up @@ -503,7 +497,7 @@ export class DataGrid {
this.activeSortingIndex = -1;
}

presortIfNeeded(): void {
presortTable(): void {
const columnToPresort = this.fields.find(
(col) => col.sortable && col.presort
);
Expand All @@ -515,7 +509,9 @@ export class DataGrid {
columnToPresort.presortDirection === 'descending'
? 'descending'
: 'ascending';
this.presortTable(direction, columnIndex, columnToPresort.type);
this.activeSortingIndex = columnIndex;
this.fields[columnIndex].sortDirection = direction;
this.sortTable(direction, columnToPresort.type, columnIndex);
}

// Column resize handlers
Expand Down

0 comments on commit 302559b

Please sign in to comment.