Commit 5f342e78 by zhaochengxiang

bug fix

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