DataTable - row.getValue() returns undefined for ID #3001
Replies: 4 comments
-
I have the same issue, not just with the |
Beta Was this translation helpful? Give feedback.
-
Same issue for |
Beta Was this translation helpful? Give feedback.
-
that is because DataTable - row.getValue() returns values from ColumnDef with defined accessorKey, except you have a ColumnDef where accessorKey is "id" row.getValue() is going to return undefined for it as it isn't defined, but you can still get your "id" value from row.original method. |
Beta Was this translation helpful? Give feedback.
-
Ah, I was getting // Make sure the `accessorKey` values match the `key` names in your `data`
<DataTable columns={columns} data={data} /> |
Beta Was this translation helpful? Give feedback.
-
When doing column definitions for a DataTable, I can get the values of all attributes of my object, but not the ID.
Using the same example from the docs, if you have a type like:
I could get the value of ID doing:
But instead of getting the ID value I get undefined, and the following console message:
"[Table] Column with id 'id' does not exist."
row.getValue()
works for all the attributes but not for ID.I can get the ID if instead I do this:
Although this works, it's odd why can't we just use the row.getValue() function like for all the other columns.
Could this be a bug in the getValue() function?
Beta Was this translation helpful? Give feedback.
All reactions