Skip to content

Commit

Permalink
Properly check column matching when clearableSort is set (fixes #1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
mstijak committed Apr 23, 2024
1 parent fceff65 commit f0e314c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/cx/src/widgets/grid/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,9 +835,13 @@ export class Grid extends Container {
let comparer = column.comparer;
let sortOptions = column.sortOptions;

if (header && header.allowSorting && column.sortable && (field || value)) {
if (header && header.allowSorting && column.sortable && (field || value || data.sortField)) {
let direction = "ASC";
if (data.sorters && (data.sorters[0].field == (field || data.sortField) || data.sorters[0].value == value)) {
if (
isNonEmptyArray(data.sorters) &&
((!!data.sorters[0].field && data.sorters[0].field == (field || data.sortField)) ||
(!!value && data.sorters[0].value == value))
) {
if (data.sorters[0].direction == "ASC") direction = "DESC";
else if (this.clearableSort && data.sorters[0].direction == "DESC") direction = null;
}
Expand Down

0 comments on commit f0e314c

Please sign in to comment.