Description
Describe the bug
When editing a cell in TreeTable, the onCellEditComplete is not called, making it impossible to fire a request to backend etc.
Also, I found out that due to switchCellToViewMode being bound to document's click event listener, the callback provided to onCellEditCompleted is bound to stale component's state, thus it's crucial to use a callback mode of setState to work on fresh data - I added such info in the docs, both for DataTable and TreeTable.
There was also an issue with the editor keeping old data after canceling the edition. I fixed that so after escaping a cell editor and opening it again, the state of editor is reset.
When it comes to reproducers, the ones existing in the docs are enough.
I'm working on the version 10.9.1 of primereact.
Reproducer
https://stackblitz.com/run?file=src%2FApp.jsx
System Information
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 AMD Ryzen 7 6800H with Radeon Graphics
Memory: 17.10 GB / 31.25 GB
Binaries:
Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
npm: 10.1.0 - C:\Program Files\nodejs\npm.CMD
pnpm: 8.5.1 - ~\AppData\Roaming\npm\pnpm.CMD
Browsers:
Edge: Chromium (127.0.2651.74)
Internet Explorer: 11.0.22621.3527
npmPackages:
react: 18.3.1 => 18.3.1
Steps to reproduce the behavior
- Render a TreeTable with onCellEditComplete callback.
- Edit a cell and click away.
Expected behavior
The callback should be called after the cell completion is finished, but it is not.