Selecting Event programatically

9 posts, 0 answers
  1. François
    François avatar
    14 posts
    Member since:
    Jul 2014

    Posted 11 Nov 2014 Link to this post

    Hi there
    I urgently need to select an event by its ID programatically after the scheduler data has been loaded the first time. How can I achive this?

    Best regards
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1442 posts

    Posted 13 Nov 2014 Link to this post

    Hello François,

    I would suggest subscribing to the Scheduler's dataBound event. Once the event is triggered you can get the occurrence by its ID using the DataSource's get method. For example: 
    function onDataBound(e){
        var task = this.dataSource.get(123); //get event with id 123
        this.date(task.start); //navigate the scheduler's view to the date of the event
        //execute custom logic here
        this.unbind("dataBound"); //unbind the DataBound event in case this handle should not executed again
    }


    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. François
    François avatar
    14 posts
    Member since:
    Jul 2014

    Posted 13 Nov 2014 in reply to Alexander Popov Link to this post

    Hi Alexander
    Thanks for your reply. Unfortunately I don't need to select a certain time frame but an EVENT within a view.
    How can I achieve this - its very urgent!

    Best regards
  4. Alexander Popov
    Admin
    Alexander Popov avatar
    1442 posts

    Posted 13 Nov 2014 Link to this post

    Hello François,

    The approach I suggest gets the event by its ID and then it navigates the current view to that time-frame, so that the event becomes visible for the user (see example). If that is not what you want, then would you please elaborate a bit on what exactly you are trying to achieve?

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. François
    François avatar
    14 posts
    Member since:
    Jul 2014

    Posted 13 Nov 2014 in reply to Alexander Popov Link to this post

    I don't want the event become visible only, i want to SELECT it, i don't know whether there is a more appropriate word in english for it.
    I want to SELECT the EVENT, not the time-frame the event is in. ;-)
  6. Alexander Popov
    Admin
    Alexander Popov avatar
    1442 posts

    Posted 13 Nov 2014 Link to this post

    Hi François,

    When talking about selecting an event, then my understanding is that the event should be highlighted (as in the example I prepared) and the Scheduler's change event triggered.
    Let me know if I am missing something.

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  7. François
    François avatar
    14 posts
    Member since:
    Jul 2014

    Posted 14 Nov 2014 in reply to Alexander Popov Link to this post

    Hi Alexander
    Your example looks promising but unfortunately it doesn't really work when loading remote data. I played around with it for a while and discovered the following.

    // doesn't work (always returns undefined)
    var ds = this.dataSource;
    console.log(ds.get(7015));

    // works, but wtf??
    setTimeout(function () {
      console.log(ds.get(7015));
    }, 500);





  8. François
    François avatar
    14 posts
    Member since:
    Jul 2014

    Posted 14 Nov 2014 in reply to François Link to this post

    Also its necessary to trigger the mouseup event as well as he otherwise tries to move around the task as soon as the scheduler gets the focus.
  9. Alexander Popov
    Admin
    Alexander Popov avatar
    1442 posts

    Posted 18 Nov 2014 Link to this post

    Hi François,

    The example I shared uses remote data and it works as expected, because the DataSource is referred from withing the dataBound event handler, which is triggered after the data becomes available. Would it be possible to share a Dojo where the issue you described is reproduced?

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top