DataGridXL / DataGridXL2

Excel-like Experience for Web Apps (The performant & reliable Vanilla Javascript data grid with Excel-like controls)
Other
498 stars 20 forks source link

Fix setcellcursorposition event #48

Closed DataGridXL closed 11 months ago

DataGridXL commented 1 year ago

setcellcursorposition event does not fire

dj-kefir-siorbacz commented 1 year ago

Hi @DataGridXL !

I wanted to store the coordinates of the last selected cell. Is it somehow possible right now?

Also, what's the code for listening for events?

grid.events.on("setcellcursorposition", (e) => {
    [...]
});

Something like this?

DataGridXL commented 11 months ago

Hi @dj-kefir-siorbacz

Sorry for the late reply! Yes, listen to events like so:

var lastSelectedCell = null;
grid.events.on('setselection', function(gridEvent){
  lastSelectedCell = gridEvent.cellCursorPosition;
});

Hope this helps! (Please open a new issue if you have futher questions)

DataGridXL commented 11 months ago

Will be fixed in v3. For v2, devs can listen to setselection event.