Commit c307c0dd by zhaochengxiang

bug fix

parent 81507949
...@@ -62,10 +62,18 @@ const ResizeableTable = (props) => { ...@@ -62,10 +62,18 @@ const ResizeableTable = (props) => {
useEffect(() => { useEffect(() => {
if (!!columns && tableWidth > 0) { if (!!columns && tableWidth > 0) {
const contentWidth = getWidth(tableWidth, extraColWidth) const contentWidth = getWidth(tableWidth, extraColWidth)
for (const item of columns??[]) {
const index = (cols??[]).findIndex(_item => item.dataIndex === _item.dataIndex && item.title === _item.title)
if (index !== -1) {
item.width = cols[index].width
}
}
setDefaultWidth(columns, contentWidth) setDefaultWidth(columns, contentWidth)
paddingCol.current.width = 0 paddingCol.current.width = 0
const cols = columns const newCols = columns
.map((col, index) => { .map((col, index) => {
const colWidth = col.width ?? 100; const colWidth = col.width ?? 100;
return { return {
...@@ -78,7 +86,7 @@ const ResizeableTable = (props) => { ...@@ -78,7 +86,7 @@ const ResizeableTable = (props) => {
}), }),
}; };
}) })
setCols(cols) setCols(newCols)
} }
}, [columns, tableWidth]) }, [columns, tableWidth])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment