glideapps / glide-data-grid

🚀 Glide Data Grid is a no compromise, outrageously react fast data grid with rich rendering, first class accessibility, and full TypeScript support.
https://grid.glideapps.com
MIT License
4.07k stars 301 forks source link

Modifying values with onClick #867

Closed pzcfg closed 10 months ago

pzcfg commented 10 months ago

For provideEditor/ProvideEditorComponent, you're provided with an onChange callback, which allows you to modify data and trigger onCell(s)Edited etc., but there isn't such a method provided to CustomRenderer's onClick. I think I could work around this by including some of my own callback functions in the cell data itself, but that feels pretty hacky and it's breaking the clean separation between pure data and mutations. Would it be possible to provide an onChange or similar to onClick?

In my current case, I'm building a number increment/decrement cell like this and would like to be able to increment and decrement the value by clicking on that region of the cell directly instead of double-clicking to open an editor and then interacting.

increment/decrement
jassmith commented 10 months ago

The onClick handler return type allows return a new cell that is the mutated value of the original cell. This then gets passed to onCellsEdited.