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

OnTimeRangeSelection on new version ||||How to change the arguments passed to onEventMoved/onEventResized?

Asked by Anonymous
9 months ago.

Let me explain my use case in Calendar.
1) On the new release, i can’t actually select a cell using left click. This was a nice nice-to-have since and now if i want to see a selected cell i have to click right. What can i do?
2) I need to round the arguments to the next hour quarter, for example, if i move an event from 9.43 to 9.58, it has to position himself on 9.45 to 10.00. I’ve already made the algorithm to round up… but i can’t pass it to onEventMoved. Can you help me?

Answer posted by Dan Letecky [DayPilot]
9 months ago.

> 1) On the new release, i can’t actually select a cell using left click. This was a nice nice-to-have since and now if i want to see a selected cell i have to click right. What can i do?

There has been no change recently to the selection logic. The time range selection is enabled by default (the timeRangeSelectedHandling property is set to "Enabled"). This lets users select a time range, either by clicking or dragging. The selection stays active until you call clearSelection() or update(). Most examples clear the selection in the onTimeRangeSelect (or onTimeRangeSelected) handler - so you might want to check these handlers.

2) I need to round the arguments to the next hour quarter, for example, if i move an event from 9.43 to 9.58, it has to position himself on 9.45 to 10.00. I’ve already made the algorithm to round up… but i can’t pass it to onEventMoved. Can you help me?

In onEventMoved, the event is already updated and rendered at the new target position. If you want to make manual adjustments, you need to handle onEventMove:

  • Call args.preventDefault() there to cancel the default action.

  • Update the event properties as needed.

  • Call events.update() for the event to apply the changes.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.