Skip to content

Implement two-state (ASC/DESC) sorting for Grid headers #9306

@tobiu

Description

@tobiu

Problem:
Currently, Neo.mjs grid header buttons use tri-state sorting (ASC, DESC, null). This was originally designed to allow reverting to an unsorted state and testing collection.allItems. However, for most real-world use cases (like the DevIndex grid), a two-state sorting mechanism (ASC, DESC) is more intuitive and expected by users.

Proposed Solution:
Introduce a new reactive configuration, useTriStateSorting_, on grid components. This config should default to false (enabling two-state sorting by default) and propagate from the GridContainer down to the HeaderToolbar and finally to the individual HeaderButtons.

  • src/grid/header/Button.mjs: Add useTriStateSorting_: false and update onClick to bypass the null state based on this config.
  • src/grid/header/Toolbar.mjs: Add useTriStateSorting_: false to propagate the setting to its child buttons and respond to dynamic changes.
  • src/grid/Container.mjs: Expose useTriStateSorting_: false to provide a top-level developer API to configure sorting behavior for the entire grid.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions