Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Grid: Add option to control sorting state #3041

Closed
mholta opened this issue Sep 1, 2023 · 2 comments · Fixed by #3172
Closed

Data Grid: Add option to control sorting state #3041

mholta opened this issue Sep 1, 2023 · 2 comments · Fixed by #3172

Comments

@mholta
Copy link

mholta commented Sep 1, 2023

Is your feature request related to a problem? Please describe.

We want to migrate from our teams DataTable to EDS Data Grid.

To be able to use the Data Grid with backend sorting we need to be able to access and control the state.

Enabling this feature allows us to:

  • Send sorting state to backend for sorting
  • Control state from url params (or any state managing)

Describe the solution you'd like

Exposing the following props/functionality would enable us to do this.

There might be other ways of doing this, but we found that separating internal and external/controlled state as a good approach that doesn't introduce too much complexity. See https://github.com/equinor/apollo-react-components/blob/8d49a7ff0a252aa227880ad9e2d94e5e00462e3e/packages/apollo-components/src/DataTable/DataTable.tsx#L94-L99.

Describe alternatives you've considered

It should be fairly simple to add this feature, since we only need to expose native Tanstack Table props.

You might also look into how Material React Table have implemented thing:

Experience from developing our own DataTable component. I would recommend avoiding nesting props of the EDSDataGrid, such as

sorting: { enable: true, manual: true, state: ..., onChange: ... }

This makes the functionality harder to find from just searching the props and it's easier to introduce breaking changes to the API.

Additional context

I'd be happy to help implementing this 😄

@yusijs
Copy link
Contributor

yusijs commented Oct 5, 2023

Hi @mholta - if you can create a PR for this, that would be great! Feel free to contact me if you have any questions! :)

@vnys
Copy link
Member

vnys commented Oct 5, 2023

@mholta We can add you to the @equinor/eds-contributors group if you’re going to create a PR. Or should we add somebody else from your team?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants