Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

fix:开启虚拟滚动,中间区域可显示的列由于列宽过长被计算成虚拟列,没有正确显示 #309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wqhui
Copy link

@wqhui wqhui commented May 20, 2022

在虚拟滚动中,计算横向可展示内容的函数getHorizontalRenderRange中,会根据当前的列宽判断是否显示:

const overscannedOffsetX = Math.max(0, offsetX - OVERSCAN_SIZE)
while (leftIndex < flat.center.length) {
const col = flat.center[leftIndex]
if (col.width + leftBlank < overscannedOffsetX) {
leftIndex += 1
leftBlank += col.width
} else {
break
}
}

但是在当前列宽过长时,也就是当前的列宽>表格剩余可显示宽度,这里的判断会直接将这列并入虚拟列,导致表格应该展示的列没有展示出来:
image

这里将其修改为表格上次计算存在剩余宽度,则当前列就应该显示

bug复现示例:https://codesandbox.io/s/xu-ni-lie-qing-kuang-xia-shou-lie-kuan-du-guo-chang-wu-nei-rong-zhan-shi-17ucgx

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant