diff --git a/CHANGELOG.md b/CHANGELOG.md index 58cb764b211..8c3bfec4f60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ **Bug fixes** - Fixed the return type of `getDefaultEuiMarkdownUiPlugins` ([#4567](https://github.com/elastic/eui/pull/4567)) +- Fixed inverse handling of boolean sorting in `EuiDataGrid` ([#4561](https://github.com/elastic/eui/pull/4561)) ## [`31.8.0`](https://github.com/elastic/eui/tree/v31.8.0) diff --git a/src/components/datagrid/data_grid_schema.tsx b/src/components/datagrid/data_grid_schema.tsx index c25e232d879..79d5019dd50 100644 --- a/src/components/datagrid/data_grid_schema.tsx +++ b/src/components/datagrid/data_grid_schema.tsx @@ -93,21 +93,21 @@ export const schemaDetectors: EuiDataGridSchemaDetector[] = [ comparator(a, b, direction) { const aValue = a.toLowerCase() === 'true'; const bValue = b.toLowerCase() === 'true'; - if (aValue < bValue) return direction === 'asc' ? 1 : -1; - if (aValue > bValue) return direction === 'asc' ? -1 : 1; + if (aValue < bValue) return direction === 'asc' ? -1 : 1; + if (aValue > bValue) return direction === 'asc' ? 1 : -1; return 0; }, icon: 'tokenBoolean', sortTextAsc: ( ), sortTextDesc: ( ), },