Skip to content

Implement default sorting function for different column types in OnyxDataGrid #3029

@JoCa96

Description

@JoCa96

Why?

As a user, I expect the default column types to have correct sorting behaviour.
Currently sorting is always done alpha-numerically, if not explicitly overriden.

Acceptance criteria

  • all DefaultSupportedTypes are sorted as expected, e.g.
    • number is sorted numerically, so 100 > 9
    • date is numerically by its timestamp, so new Date("2020-02-01") > new Date("2020-01-01")
  • like in the renderer.ts it is required through typing, that every possible DefaultSupportedTypes has a defined sorting
  • the sortFunction to use is determined by the following priority list, the first defined one is used:
    1. sortFunc defined via columnConfig
    2. sortFunc defined via custom type[Renderer]Sortings (see nice-to-have)
    3. sortFunc defined from the default types, if matching
    4. fallback sort function

nice-to-have

  • the useSortings SortOptions is extended to allow the users to define sorting based on a TypeRenderer type

Implementation details

  • The default sortings should located in the OnyxDataGrid/features/sorting directory/files.
  • the generic TTypeRenderer type is passed through to the

Definition of Done

  • Should be covered by tests:

    • functional tests (Playwright or unit test)
    • visual tests (Playwright screenshots)
  • Make sure, that

    • follow-up tickets were created if necessary
    • updated version + documentation is deployed
    • Storybook can show the feature
    • Storybook code snippet of new/changed examples are checked that they are generated correctly
    • Namings are aligned with Figma

Approval

Storybook
Code

Metadata

Metadata

Assignees

Labels

devRequires technical expertise

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions