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

[DataGrid] getAllRows method in DataGrid's apiRef #4215

Closed
2 tasks done
majdajroudi opened this issue Mar 17, 2022 · 3 comments
Closed
2 tasks done

[DataGrid] getAllRows method in DataGrid's apiRef #4215

majdajroudi opened this issue Mar 17, 2022 · 3 comments
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement

Comments

@majdajroudi
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

I recently updated the MUI in my project to the latest version (version 5) in order to use new features added to the DataGrid component.

I am using apiRef prop to manage the editable feature of the grid. It seemed to me that the ref includes many functions regarding rows but is missing key function which is getAllRows.

I was wondering if it would be possible to add this function to the ref. It seems like a feature that can be achieved easily and I would be more than happy to work on it.

Examples 🌈

No response

Motivation 🔦

No response

@majdajroudi majdajroudi added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 17, 2022
@majdajroudi majdajroudi changed the title getAllRows method in DataGrid's apiRef [DataGrid] getAllRows method in DataGrid's apiRef Mar 17, 2022
@hbjORbj hbjORbj added new feature New feature or request component: data grid This is the name of the generic UI component, not the React module! labels Mar 17, 2022
@alexfauquette alexfauquette removed new feature New feature or request status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 17, 2022
@alexfauquette alexfauquette transferred this issue from mui/material-ui Mar 17, 2022
@alexfauquette alexfauquette reopened this Mar 17, 2022
@alexfauquette
Copy link
Member

Hi @majdajroudi To get access to state data, we encourage the use of selectors

gridRowsStateSelector which returns the rows. You can also get the rows ids with gridRowIdsSelector and gridRowsLookupSelector which return s an object {[rowId]: rowModel}

We are documenting them, but there is still some work to do

Does that solves your problem or do you see cases where a new method is needed?

@flaviendelangle
Copy link
Member

flaviendelangle commented Mar 17, 2022

Related to #3717 which should clearly document how to access the various row listings.

And somehow to #4151 where I propose to remove some of the methods because it is not obvious why some exists and not others, and we don't want to create the 30 possible combination (for each listing we would need the method to return the listing, to return the index of a row based on its ID, to return the ID of a row based on its index).

@flaviendelangle flaviendelangle added the support: question Community support but can be turned into an improvement label Mar 25, 2022
@flaviendelangle
Copy link
Member

Closing this one, we can continue the discussion on how to document it better in #3717

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

4 participants