Commit 5f342e78 by zhaochengxiang

bug fix

parent 632047c7
...@@ -2,7 +2,6 @@ import React, { useEffect, useState, useRef, useMemo } from 'react'; ...@@ -2,7 +2,6 @@ import React, { useEffect, useState, useRef, useMemo } from 'react';
import { Table } from 'antd'; import { Table } from 'antd';
import { Resizable } from 'react-resizable'; import { Resizable } from 'react-resizable';
import ResizeObserver from 'rc-resize-observer' import ResizeObserver from 'rc-resize-observer'
import produce from 'immer';
const scrollbarWidth = getScrollbarWidth() const scrollbarWidth = getScrollbarWidth()
...@@ -63,19 +62,18 @@ const ResizeableTable = (props) => { ...@@ -63,19 +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)
let newCols = produce(columns, (draft) => {
(draft??[]).forEach(item => { for (const item of columns??[]) {
const index = (cols??[]).findIndex(_item => item.dataIndex === _item.dataIndex && item.title === _item.title) const index = (cols??[]).findIndex(_item => item.dataIndex === _item.dataIndex && item.title === _item.title)
if (index !== -1) { if (index !== -1) {
item.width = cols[index].width item.width = cols[index].width
} }
}) }
})
setDefaultWidth(columns, contentWidth)
setDefaultWidth(newCols, contentWidth)
paddingCol.current.width = 0 paddingCol.current.width = 0
newCols = (newCols??[]) const newCols = (columns??[])
.map((col, index) => { .map((col, index) => {
const colWidth = col.width ?? 100; const colWidth = col.width ?? 100;
return { return {
......
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