You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm using react-table for a CRUD with the expanded rows feature.
I would like to add ad column containing the id of each rows so that when I will delete or add a subRow in the table the id of each rows will adjust accordingly
this will produce a table with a parent row bob and 2 subRows paul and claire.
If I add to the data another subRow between paul and claire named carl: { "name":"carl", "age":40, "subRows":[] }
I would like to have an id column in the table that would refresh showing the id that is generated with useExpanded:
bob row: 0
paul row: 0.0
carl row: 0.1
claire row: 0.2
Any suggestion to how I can have this id to the data array used in the table?
const [data, setData] = useState([]);
I found that id only inside Rows variable, which structure is quite different from the data variable, is there any way to instead have that id inside data variable?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I'm using react-table for a CRUD with the expanded rows feature.
I would like to add ad column containing the id of each rows so that when I will delete or add a subRow in the table the id of each rows will adjust accordingly
data example:
[ { "name":"bob", "age":5, "subRows":[ { "name":"paul", "age":10, "subRows":[] }, { "name":"claire", "age":20, "subRows":[] } } ]
this will produce a table with a parent row bob and 2 subRows paul and claire.
If I add to the data another subRow between paul and claire named carl:
{ "name":"carl", "age":40, "subRows":[] }
I would like to have an id column in the table that would refresh showing the id that is generated with useExpanded:
bob row: 0
paul row: 0.0
carl row: 0.1
claire row: 0.2
Any suggestion to how I can have this id to the data array used in the table?
const [data, setData] = useState([]);
I found that id only inside Rows variable, which structure is quite different from the data variable, is there any way to instead have that id inside data variable?
Thank you !
Beta Was this translation helpful? Give feedback.
All reactions