Replies: 1 comment
-
I had the same exact issue. This is how I got it to work.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using Material-React-Table v2 - I am a recent convert from material-table and am still learning.
I am particularly interested in implementing a number of tables with CRUD functionality.
And I prefer to use inline row editing.
In my data, I have one column which holds the unique key to a row in the database.
I load this column in (and others) from the database to populate the table.
The user shouldn't see this column so I hide this column with ...initialState: { columnVisibility: {key_column: false } {,...
When the user updates the row, I need that key to update the database (via axios and nodejs backend)
In const table = useMaterialReactTable, I have ...onEditingRowSave: handleRowSaver
Elsewhere I have const handleRowSaver = async ({values,table}) => { ...
When I run console.log(values) in handleRowSaver, I noticed that key_column is missing!
When I remove key_column : false from columnVisibility, it shows up on the screen and it shows up in values dictionary.
I do not want to show key_column on the screen (due to real estate constraints) so I tried setting column props such as:
...{accessorKey: key_column, header: "Key", size:0, maxSize:0, enableEditing: false}...
but that had no effect and key column was still shown.
Is there a way to load the key, hold it in a hidden column and have it accessible for all CRUD action, like update and delete?
Apologies if I missed something in the online example or docs .
Beta Was this translation helpful? Give feedback.
All reactions