VisActor / VTable

VTable is not just a high-performance multidimensional data analysis table, but also a grid artist that creates art between rows and columns.
https://visactor.io/vtable
MIT License
1.57k stars 129 forks source link

[Bug]React-VTable 单元格双击事件 onDblClickCell 未触发 #2057

Closed mzhang-eric closed 1 month ago

mzhang-eric commented 1 month ago

版本 1.5.0

单元格双击事件未触发

onDblClickCell={(args) => {
    console.log('onDblClickCell', args);
}}
Rui-Sun commented 1 month ago

提供一下复现环境吧,没有复现这个问题 image

mzhang-eric commented 1 month ago

这个看起来是我使用问题,我同时监听了单元格选中事件和双击事件,在单元格的选中事件中调用了 updateColumns 方法触发了重绘,导致了 onDblClickCell 无效。

root.render(
  <ReactVTable.ListTable
    option={option}
    height={'500px'}
    onReady={(tableInstance) => {
      window.tableInstance = tableInstance;
    }}
    onSelectedCell={args => {
      // 这里是想在单元格选中时,将对应的列表头设置一个特殊样式
      // 因此在选中之后调用了 updateColumns 进行重绘
      window.tableInstance.updateColumns(option.columns);
    }}
    onDblClickCell={args => {
      alert('onDblClickCell');
    }}
  />
);