mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
4.08k stars 1.26k forks source link

[data grid] How to initialize empty rows like Google Sheets #12886

Closed louisaaron closed 5 months ago

louisaaron commented 5 months ago

The problem in depth

We're trying to initialize a datagrid with many empty rows, much like Google Sheets. Our grid is socketed so that live updates come through much like Google Sheets, but data is stored in rows in Postgres. We want to automatically generate a new row each time data is populated in an empty row (and to delete rows when a row becomes empty again).

Your environment

`npx @mui/envinfo` ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: Initialize empty rows Order ID: 85118

DanailH commented 5 months ago

Hey @louisaaron that's an interesting use case. Technically you can do that by providing the grid with empty rows. You would then need to update the rows you provide via the API - you can check an example of how to do that here: https://mui.com/x/react-data-grid/row-updates/#high-frequency

Regarding generating a new row each time data is populated in a new row - you can do that as well by appending a new empty row to the row model

louisaaron commented 5 months ago

Thanks!

michelengelen commented 5 months ago

@louisaaron does the proposed solution fit yur use-case? If so please feel free to close this issue! Thanks! 🙇🏼

louisaaron commented 5 months ago

We haven't had a chance to try it out yet but will close unless we have an issue. thanks

github-actions[bot] commented 5 months ago

:warning: This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@louisaaron: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.