Closed Pamwamba closed 1 year ago
I found an other way to do what i wanted to, by adding a header just before the datasheetgrid. But I'm still curious about my issue. I'm closing it.
Your first column has an "old" version of deleteCol. You can use a Ref to always have the last up to date version.
Hey, i know this is not a feature nor an issue of the grid, so I tried to manage it.
But I have a strange behavior and maybe someone already did it and could help me.
Here is the code https://codesandbox.io/s/jolly-rui-8c0ylt?file=/src/grid.jsx
I have an input and button to add a column with a name, this works perfectly. But when i try to delete a column, it doesn't work as expected.
How to reproduce :
edit: deleting from the end looks working
The most strange about it is that in "handleDeleteCol", I've put a console.log of columns. This only shows columns before the one i want to delete. (e.g : if I clic on 'a' (the 4th column), it only shows an array of 3 cols (the 3 default columns) even if I remove the setColumns).
Maybe I did something wrong, do you see something ? Thanks