Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react 函数式组件,如何监听单元格编辑 #1434

Closed
Akaid0127 opened this issue Apr 3, 2024 · 3 comments · Fixed by #1438
Closed

react 函数式组件,如何监听单元格编辑 #1434

Akaid0127 opened this issue Apr 3, 2024 · 3 comments · Fixed by #1438
Assignees

Comments

@Akaid0127
Copy link

Akaid0127 commented Apr 3, 2024

抱歉,是真的没找到对应监听事件 api 在哪里,或者怎么在函数式组件中使用以下 code
const tableInstance = new VTable.ListTable(option); tableInstance.on('change_cell_value', () => { // 编辑单元格数据 });

@fangsmile fangsmile self-assigned this Apr 3, 2024
@Akaid0127
Copy link
Author

Akaid0127 commented Apr 3, 2024

研究出来咋做了,放到 onReady 里就可以了~

const handleTableReady = (instance: IVTable, isInitial: boolean) => {
  instance.on('change_cell_value', () => {
    // 编辑单元格数据
    console.log("cell has change");
  });
};

return (
  <ListTable
    height={500}
    option={tableConfig}
    records={tableRecords}
    onReady={(instance: IVTable, isInitial: boolean) => handleTableReady(instance, isInitial)}
  />
);

@fangsmile
Copy link
Contributor

嗯嗯 可以的 不过我这两天补一下onChangeCellValue

@Akaid0127
Copy link
Author

感谢!大佬喝阔乐

@fangsmile fangsmile linked a pull request Apr 3, 2024 that will close this issue
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants