Our pure JavaScript Scheduler component


Post by piotr.pysk »

I want to deselect row by clicking on the selected row again. Currently, the https://www.bryntum.com/docs/scheduler/api/Scheduler/view/Scheduler#event-selectionChange event doesn't support that action. I tried to use the https://www.bryntum.com/docs/scheduler/api/Scheduler/view/Scheduler#event-cellClick event (when the row containing clicked cell is selected, I deselect this row), but this event is triggered after https://www.bryntum.com/docs/scheduler/api/Scheduler/view/Scheduler#event-selectionChange event, so when i click on the row it is selected and then deselected immediately.


Post by mats »

You can try:

grid.on('cellmousedown', ({ event, record }) => {
    if (grid.isSelected(record)) {
        grid.deselectRow(record);
        event.preventDefault();
    }
});

Post by Animal »

CTRL/click will deselect the currently selected row.

If you want to only select a maximum of one row at a time then configure the grid with

selectionMode : {
    multiSelect : false,
    row         : true
}

Post by piotr.pysk »

mats wrote: Sat Oct 16, 2021 9:40 am

You can try:

grid.on('cellmousedown', ({ event, record }) => {
    if (grid.isSelected(record)) {
        grid.deselectRow(record);
        event.preventDefault();
    }
});

Thank you. This solution works as needed.


Post Reply