right-click doesn't allways fire changed event

4 posts, 0 answers
  1. JKattestaart
    JKattestaart avatar
    8 posts
    Member since:
    Jan 2007

    Posted 11 Jun 2015 Link to this post

    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];

    ..

     

  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 15 Jun 2015 Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. JKattestaart
    JKattestaart avatar
    8 posts
    Member since:
    Jan 2007

    Posted 15 Jun 2015 in reply to Vladimir Iliev Link to this post

    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?

  5. JKattestaart
    JKattestaart avatar
    8 posts
    Member since:
    Jan 2007

    Posted 16 Jun 2015 in reply to JKattestaart Link to this post

    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

Back to Top
UI for ASP.NET MVC is VS 2017 Ready