Skip to content

Allow alternate key for DataTable id #5898

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

Open
lindseywild opened this issue Apr 7, 2025 · 2 comments · May be fixed by #5907
Open

Allow alternate key for DataTable id #5898

lindseywild opened this issue Apr 7, 2025 · 2 comments · May be fixed by #5907
Labels

Comments

@lindseywild
Copy link
Contributor

lindseywild commented Apr 7, 2025

The key for <TableRow> and it’s associated children is generated based off of the id of the passed in data. It would be helpful to be able to customize the key that is used for id since id may not always exist in the data. For instance, I have a private _uid field that I’d prefer to generate the key off of. In my case, the user has access to update the id field so this may results in duplicate keys if they choose the same id.

Example data:

const sampleData = [
    {id: 1, name: 'Sabine', cuisine: 'Italian', location: 'New York', rating: 4.5, _uid: 'abc123'},
    {id: 2, name: 'The Matador', cuisine: 'Mexican', location: 'Los Angeles', rating: 4.0, _uid: 'abc12334'},
    {id: 3, name: 'Nagoya Steakhouse', cuisine: 'Japanese', location: 'San Francisco', rating: 4.2, _uid: 'abc1234'},
  ]
@joshblack joshblack added enhancement New feature or request component: DataTable labels Apr 7, 2025
@bibektamang7 bibektamang7 linked a pull request Apr 8, 2025 that will close this issue
13 tasks
@sunnyi101
Copy link
Collaborator

Fr to look into next steps here

@francinelucca
Copy link
Member

Will be closed by #5907, removing from FR board as this should be able to follow normal review-merge pipeline

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

Successfully merging a pull request may close this issue.

4 participants