Commit 565e943d by zhaochengxiang

bug fix

parent c307c0dd
...@@ -66,10 +66,17 @@ function FC<RowType extends object = any>({ width, maxHeight, pageSize, pageNum, ...@@ -66,10 +66,17 @@ function FC<RowType extends object = any>({ width, maxHeight, pageSize, pageNum,
useEffect(() => { useEffect(() => {
if (!!columns && tableWidth > 0) { if (!!columns && tableWidth > 0) {
const contentWidth = getWidth(width ?? tableWidth,extraColWidth) const contentWidth = getWidth(width ?? 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 render = getRender(col); const render = getRender(col);
const colWidth = col.width ?? 100; const colWidth = col.width ?? 100;
...@@ -83,7 +90,7 @@ function FC<RowType extends object = any>({ width, maxHeight, pageSize, pageNum, ...@@ -83,7 +90,7 @@ function FC<RowType extends object = any>({ width, maxHeight, pageSize, pageNum,
}), }),
}; };
}) })
setCols(cols) setCols(newCols)
} }
}, [columns, tableWidth, width, extraColWidth]) }, [columns, tableWidth, width, extraColWidth])
......
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