react-datasheet-grid
react-datasheet-grid copied to clipboard
Add multiple rows causes blank space at the top of table
trafficstars
Discussed in https://github.com/Equify/react-datasheet-grid/discussions/144
Originally posted by Richard-97 April 5, 2022 Hey,
I have a problem with adding multiple rows. There is blank space at the top of the table. The same problem is happing int he demo at home page (added video). The problem is when you select more than 4 rows.
Could you please look on this problem? Thank you.
https://user-images.githubusercontent.com/42608419/161763345-daebffa6-9cb8-4d0b-bc35-9655c71cde4d.mov
It happen at onChange function
if (operation.type === 'CREATE') {
const count = operation.toRowIndex - operation.fromRowIndex
const addedRows = rows.slice(operation.fromRowIndex, operation.toRowIndex)
if (!operation.fromRowIndex) {
setRows([
...addedRows,
...rawRows.slice(operation.fromRowIndex),
])
return
}
setRows([
...rawRows.slice(0, operation.fromRowIndex),
...addedRows,
...rawRows.slice(operation.fromRowIndex),
])
}
Works fine for me.
Macbook: Firefox, Chrome