Add row in the middle of two rows
popo63301 opened this issue · 1 comments
How do you approach adding a row in the middle of two rows? I've read there's a system of key of each cell, so if you add a row in the middle of two, you probably need to change every key, no?
Right, every row has a key defined by the getRowKey(row)
prop. You should use an identifier of a row object not related to its index in the list. For examle, an ID
of a row's entity that you load from a server. So, using this approach you can put a row with a new ID
in the middle of the list and other rows will still have the same keys.
What about changing the rows array, you should store rows in the state of parent component, so you can call setState
of this parent component with updated rows to render a grid with them. For example, see how you can put new rows in a grid in this section of the docs.