-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
fix: Passing ID to "Actions" column (docs) #297
Conversation
## Issue An `undefined` value was being passed in as props to the "Actions" column in the "Update columns definition" section. This is because the `accessor` was _only_ passing in the email value so the `cell` method had no knowledge of the ID of the associated item. Also, the ID value lives on the `item.value` not the `item`.
|
Someone is attempting to deploy a commit to a Personal Account owned by @huntabyte on Vercel. @huntabyte first needs to authorize it. |
FWIW @huntabyte I did a little screen recording showing the effect with the current implementation in the docs and my proposed change. I was at first just recreating the tables in the docs (what would be really cool would be |
Hey @jeffpohlmeyer thanks for this! Something I recently discovered is that I'm doing things incorrectly in the data table, specifically for the select/checkbox column, as well as the actions column. Those columns should be using If you're up for refactoring the table to use that (which prevents some weird bugs that can occur when hiding/filtering) then feel free! Otherwise I will update it soon as I have some time! |
Sounds good. I'll definitely give it a shot but probably won't have a chance before Monday. |
…section, as well as aligning the methodology of displaying `isSelected` with source documentation
I'm not sure that the actions column should be using |
@jeffpohlmeyer I thought about that as well, but the way I interpreted that is this represents something specific/unique within the dataset. The issues start to become more obvious when you also want to display an We can still destructure and access the |
The only issue I ran into, though, when using the I'll play around a bit more in the morning (Eastern time) |
No worries @jeffpohlmeyer, I recently did it and was trying to find the branch but I guess I never committed it. To get around that type of error, you have to narrow the typing using this function here. So something like: cell: ({ row }) => {
if (row.isDisplay()) {
// now I know the type and can access row.original
console.log(row.original.id)
}
} |
Issue
An
undefined
value was being passed in as props to the "Actions" column in the "Update columns definition" section. This is because theaccessor
was only passing in the email value so thecell
method had no knowledge of the ID of the associated item. Also, the ID value lives on theitem.value
not theitem
.