-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[docs] Mention row id
requirement and document getRowId
prop
#3765
Conversation
These are the results for the performance tests:
|
Co-authored-by: Flavien DELANGLE <flaviendelangle@gmail.com>
Well, it looks like it's not up to me to decide whether there's demo preview or not 😀 |
@cherniavskii here is an example with the code not expanded by default:
|
@@ -15,6 +15,17 @@ The rows can be defined with the `rows` prop, which expects an array of objects. | |||
|
|||
{{"demo": "pages/components/data-grid/rows/RowsGrid.js", "bg": "inline"}} | |||
|
|||
> ⚠️ Each row should have a unique id. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also mention that the "id" property doesn't need to be specified in the columns
prop. An user wasn't aware of this: #346 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this ?
⚠️ Each row should have a unique id even when no there is noid
column
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Looks like the issue here is understanding columns
- users might think that every field in their rows data is required to be reflected in columns
as well.
Maybe instead we should mention on Columns page that it's not required for columns
to cover all the fields available in rows data?
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be, but then we would need to say there that, although the "id" is required, a "id" column is not.
Now I'm convinced to your initial proposal - I'll mention id column here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to make it as clear as I could and ended up with this:
Note that column definition for
id
field is not required.
@flaviendelangle interesting, I did not expect this setting to toggle demo code preview! |
@@ -15,6 +15,17 @@ The rows can be defined with the `rows` prop, which expects an array of objects. | |||
|
|||
{{"demo": "pages/components/data-grid/rows/RowsGrid.js", "bg": "inline"}} | |||
|
|||
> ⚠️ Each row should have a unique id. |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Co-authored-by: Matheus Wichman <matheushw@outlook.com>
Currently
DataGrid
throws an error if row doesn't have anid
property.This is not documented though, and there's
getRowId
prop that can be used instead.I've updated the error message to mention
getRowId
prop as well.Preview: https://deploy-preview-3765--material-ui-x.netlify.app/components/data-grid/rows/