search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

forcing mousedown after calling scheduler's selectTimeRange method

Asked by Vincent
1 month ago.

I am trying to achieve a certain behavior in allowing users to select a time range over events while holding shift(basically, trying to make it so that holding shift allows me treat events as though they weren't there in the scheduler)

I am fairly close but when I call the selectTimeRange method with the "dontFireEvent" set to true on mousedown, I would like my mousedown event to effectively assume that I am trying to control this time range. Currently, i have to call the selectTimeRange on mousedown, and then click it and hold mousedown again to adjust the range.

Is there a way to go directly into the "adjusting range" functionality/behaviour of the select time range, as it is created?

Answer posted by Dan Letecky [DayPilot]
1 month ago.

This is probably a follow up on this question:
https://forums.daypilot.org/question/5177/ignoring-left-click-behaviour-for-events

You should be able to use onGridMouseDown, rectangleSelectHandling and onRectangleSelecting to achieve that:

https://javascript.daypilot.org/demo/scheduler/eventmultiselecting.html
https://code.daypilot.org/85404/javascript-scheduler-select-a-time-range-over-multiple-rows

Let me know if it doesn't help.

Comment posted by Vincent
1 month ago.

Correct, it is a follow up and I am still effectively trying to allow users to create new overs over existing one under certain conditions. I am not sure if this does help, as I am not trying to select events but rather trying to create a new one using a time-range selector. I will experiment with this for now and see if it can be of use.

Comment posted by Dan Letecky [DayPilot]
1 month ago.

Please take a look at this example:

https://code.daypilot.org/85404/javascript-scheduler-select-a-time-range-over-multiple-rows

This lets you start the selection anywhere in the Scheduler grid (over events as well) if you hold Shift during mousedown.

An explanation will be added later to the tutorial.

Comment posted by Vincent
1 month ago.

This does seem to have some potential. I just have two questions with this. There seems to be a way to capture the mousedown event when clicking on the grid itself with the "onGridMouseDown" but there doesn't seem to be any way to capture it when the user Mouse downs on an event. There's an event click but no onEventMouseDown.

Also, is there a way to add a display of the from and to dates to the rectangle, the same way they appear with the default time range selection?

Comment posted by Dan Letecky [DayPilot]
1 month ago.

> There seems to be a way to capture the mousedown event when clicking on the grid itself with the "onGridMouseDown" but there doesn't seem to be any way to capture it when the user Mouse downs on an event. There's an event click but no onEventMouseDown.

The onGridMouseDown works for the whole grid (including events).

> Also, is there a way to add a display of the from and to dates to the rectangle, the same way they appear with the default time range selection?

Unfortunately, that isn't supported. The selection created using the multirange API is static.

New Reply
This reply is
Your name (optional):