table icon indicating copy to clipboard operation
table copied to clipboard

虚拟滚动时,table getRowKey 索引index 为undefined

Open hairgc opened this issue 1 year ago • 0 comments

使用虚拟滚动时,设置rowKey有个特殊处理,当唯一值id不存在时,使用索引index代替

rowKey = {(record, index)=>(record?.id || index )}

但索引打印为undefined

看了是因为虚拟滚动Table内部使用rc-virtual-list组件时未传递index,建议支持下索引,或者直接在Table rowKey移除对index的支持,否则使用时容易出现bug

https://github.com/react-component/table/blob/b4a5a03615cfe19b3060d486cb6657fba2934b88/src/VirtualTable/BodyGrid.tsx#L234

hairgc avatar Apr 17 '24 02:04 hairgc