Our pure JavaScript Scheduler component


Post by subhayansarkar »

Hi Team,

I have a use case where I want my users to select the event and then press ctrl + left arrow to resize the startDate (extend the event from left) of the event and ctrl + right arrow to resize from the endDate (extend the event from right) of the event.

Is there a way to do this. Can anybody help me out with an example snippet to do the same ?


Post by johan.isaksson »

Hi,

ctrl + arrow is currently reserved for event navigation, but if another modifier key is acceptable you could try something like this in your Scheduler config:

keyMap : {
        'Shift+ArrowLeft' : ({ eventRecord }) => {
            eventRecord?.shift(-1, 'h');
        }
    }
Best regards,
Johan Isaksson

Post by subhayansarkar »

Hi,

Thanks for the response.
Is there some method similar to shift, using which I can just extend the duration of the event, in simpler terms what selecting and resizing using mouse does, I want to do the same behavior with some keyboard shortcut.


Post by johan.isaksson »

Hi,

not a single method, you would have to do some calculations for the start side. On the end side you can just extend duration.
For start, something like:

eventRecord?.setStartDate(DateHelper.add(eventRecord.startDate, -1, 'h'), false);

false tells it to extend the duration, by default setStartDate keeps it and thus moves instead of resizes

Best regards,
Johan Isaksson

Post Reply