glide-data-grid
glide-data-grid copied to clipboard
onPaste does not fill all selected rows
Currently, I am working on a table with a company that expects almost identical Excel behavior. One missing thing is copying and pasting one row into multiple selected rows. Is this a feature that you intend to add or is this something you might delegate to devs using your library to implement themselves due to some technical complexity/edge cases?
Also if I am not mistaken, onPaste is currently working with onCellEdited, is this something that can be moved to onCellsEdited? That would greatly improve DX
In my quick test onCellsEdited gets called for both onPaste and fillHandle
In my quick test
onCellsEditedgets called for bothonPasteandfillHandle
that is good to know. thanks @pzcfg !
Implementation proposal:
interface DataEditorProps {
...otherCrap,
onPasteBehavior: undfined | {
demuxRows: boolean,
demuxColumns: boolean,
demuxRanges: boolean,
}
}
Imo it would be nice to have onPaste trigger only onCellsEdited (or give the choice to the user as you proposed). That way we can have centralized logic in onCellsEdited for everything from actually editing to pasting events. It would improve DX but also performance without having to manually prevent events from happening.
I dont understand why you think that would be better.
Now we have to maintain both onCellsEdited and onCellEdited. Sure, we can prevent onPaste from triggering onCellEdited but IMO onCellEdited is kinda redundant anyway, since we have to maintain basically two functions to handle data change. I believe that it would be best if we could decide if we want to use one or the other, for example I would rather handle everything in onCellsEdited, but that depends on the use case, etc. So having an option to opt-in into one of these 2 functions would be ideal from DX perspective
onCellsEdited was updated in 5.0.1 to always trigger, you can not implement onCellEdited at all if you like. onCellEdited will always trigger if onCellsEdited triggered.
Ah well, in that case, everything is solved basically. Great stuff!
This is as good as its going to get for a bit in 6.0.0. It now handles ranges much better. We might do more improvements in the future with pattern filling and handlng demuxing.