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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] consider providing defaults for rows and columns prop #13111

Open
Janpot opened this issue May 13, 2024 · 1 comment
Open

[data grid] consider providing defaults for rows and columns prop #13111

Janpot opened this issue May 13, 2024 · 1 comment
Labels
component: data grid This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature feature: Rendering layout Related to the data grid Rendering engine

Comments

@Janpot
Copy link
Member

Janpot commented May 13, 2024

Summary

I'm very aware that this is a minor usability issue, but it's been bugging me for a long time 馃槃

Currently, when adding a grid to my app without specifying any properties, an error is thrown:

TypeError: Cannot read properties of undefined (reading 'forEach')

One always has to specify rows and columns properties. I propose to make these properties optional and have them default to an empty array. The grid would then just display an empty grid with no columns.

I understand that a grid without these properties is not very meaningful for a production app, but I think there is a good reason to add them anyway. When I'm adding a grid in the page during development, almost always is my first concern to take care about sizing and fitting it in the page layout. Only once I've established that and verified in my browser the grid is where I want, I start working on the data loading. So I always find myself writing <DataGrid rows={[]} columns={[]} /> anyway. IMO you may as well just make them empty arrays by default.

Examples

No response

Motivation

No response

Search keywords: rows columns default

@Janpot Janpot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label May 13, 2024
@michelengelen michelengelen added component: data grid This is the name of the generic UI component, not the React module! feature: Rendering layout Related to the data grid Rendering engine enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 14, 2024
@michelengelen michelengelen changed the title [DataGrid] consider providing defaults for rows and columns prop [data grid] consider providing defaults for rows and columns prop May 14, 2024
@michelengelen
Copy link
Member

Might also be a candidate for a "good first issue"

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! enhancement This is not a bug, nor a new feature feature: Rendering layout Related to the data grid Rendering engine
Projects
None yet
Development

No branches or pull requests

2 participants