This is a migrated thread and some comments may be shown as answers.

right-click doesn't allways fire changed event

3 Answers 103 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
JKattestaart
Top achievements
Rank 1
JKattestaart asked on 11 Jun 2015, 09:55 AM

Hello,

 I have a context menu on a appointment with a right click, together with a changed event on a selectable scheduler to track the selected item, which I need in the contextmenu. The problem is when I have a context menu open and I do a right-click on another appointment the change event for the scheduler doesn't fire. This leads to actions on the wrong event because the selected item is not updated.

How can I solve this?

events.Change("onSelectionChanged");

 function onSelectionChanged(e) {
   currentEvent = e.events[0];

..

 

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 15 Jun 2015, 08:19 AM
Hello John,

Please note that by default the Scheduler doesn't change the selection on "right" click of the mouse - that why custom code would be required in order to achieve the desired behavior. For example you can bind custom "click" handler to the event elements and when the button clicked is the right mouse button to call the scheduler "select" event. Please check the example below:

Regards,
Vladimir Iliev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
JKattestaart
Top achievements
Rank 1
answered on 15 Jun 2015, 10:59 AM

OK, I tried this:

function onMenuOpen(e) { 
   var offset = $(e.target).offset();
   var scheduler = $('#AfsprakenSchedule').data('kendoScheduler');
   var slot = scheduler.slotByPosition(offset.left, offset.top);
   scheduler.select({start:slot.startDate, end:slot.endDate});
 }

 

But it complaints the select method is not valid. The scheduler value is correct?

0
JKattestaart
Top achievements
Rank 1
answered on 16 Jun 2015, 09:57 AM

I managed to bypass the changed with:

function onMenuOpen(e) {
   var uid = $(e.target).attr('data-uid');
   var scheduler = $('#AfsprakenSchedule').data('kendoScheduler');
   var event = scheduler.dataSource.getByUid(uid);
   setMenuForEvent(event);
 }

 This doesn't select the appointment, but by keeping track of the current appointment with the right-click i'm able to act on the correct appointment.

Thanks for the suggestions

Tags
Scheduler
Asked by
JKattestaart
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
JKattestaart
Top achievements
Rank 1
Share this question
or