using a loop to determine the next table cell to shrink

This commit is contained in:
Carter 2025-06-04 10:55:14 -06:00
parent 5b55563886
commit 64748bd76d

View file

@ -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)
}