using a loop to determine the next table cell to shrink
This commit is contained in:
parent
5b55563886
commit
64748bd76d
1 changed files with 8 additions and 1 deletions
|
|
@ -471,7 +471,14 @@ export default function ResponsiveTable<T extends Object>(props: Props<T>) {
|
|||
|
||||
let newWidths: number[] = [...rowWidths]
|
||||
newWidths[index] = newWidths[index] - (dragStart - e.clientX)
|
||||
newWidths[index+1] = newWidths[index+1] + (dragStart - e.clientX)
|
||||
// newWidths[index+1] = newWidths[index+1] + (dragStart - e.clientX)
|
||||
newWidths.every((width, j) => {
|
||||
if (j <= index || width === 0) return true
|
||||
else if (newWidths[j] !== undefined) {
|
||||
newWidths[j] = newWidths[j] + (dragStart - e.clientX)
|
||||
return false
|
||||
}
|
||||
})
|
||||
setRowWidths(newWidths)
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue