Felt that there are too few events exposed #171
-
Hi there, First, I love this component. But one problem I have is the fact that there is only 1 event : OnChange , to tell me that something has changed on the grid. But the problem is, this event is triggered on every key press (if i'm editing a cell, and i type "apple", it triggers this event 5 times). And because OnChange is usually hooked up to the onchange event handler, which propagates changes back to the datasource, this will trigger a refresh/redraw of the entire grid on every keypress. This is fine if I'm not doing anything heavy in the rerendering of the grid. But if we try to do anything (like building a collapsible treelist - as given in the samples here : https://react-datasheet-grid.netlify.app/docs/examples/collapsible-rows) , it is a downright performance killer. What is essentially happening is that we have to reassemble the entire treelist array on every keypress! There really should be an event called "onCellLeave" or "onCellDoneEditing" , where it triggers only after one has finished his changes on that cell. Ed |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @edzehoo, Now regarding the performance issue, you are absolutely right, but it is up to the component to call "onChange" when needed. Luckily the built-in text column has a continuousUpdates property that let you only update the data when blurred (huge performance gain). Let me know if that helps! |
Beta Was this translation helpful? Give feedback.
Hello @edzehoo,
We have such events, but on the grid itself: https://react-datasheet-grid.netlify.app/docs/api-reference/props#callbacks
For "onCellLeave" you might want to look at
onActiveCellChange
.For "onCellDoneEditing" you might want to look at
onBlur
.But that might not be what you are really looking for, check this out instead 👇
Now regarding the performance issue, you are absolutely right, but it is up to the component to call "onChange" when needed. Luckily the built-in text column has a continuousUpdates property that let you only update the data when blurred (huge performance gain).
Let me know if that helps!