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

Selecting Event programatically

8 Answers 172 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
François
Top achievements
Rank 1
François asked on 11 Nov 2014, 09:47 AM
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

8 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 13 Nov 2014, 08:37 AM
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!
 
0
François
Top achievements
Rank 1
answered on 13 Nov 2014, 10:13 AM
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
0
Alexander Popov
Telerik team
answered on 13 Nov 2014, 11:46 AM
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!
 
0
François
Top achievements
Rank 1
answered on 13 Nov 2014, 12:15 PM
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. ;-)
0
Alexander Popov
Telerik team
answered on 13 Nov 2014, 12:36 PM
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!
 
0
François
Top achievements
Rank 1
answered on 14 Nov 2014, 11:37 AM
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);





0
François
Top achievements
Rank 1
answered on 14 Nov 2014, 11:47 AM
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.
0
Alexander Popov
Telerik team
answered on 18 Nov 2014, 09:37 AM
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!
 
Tags
Scheduler
Asked by
François
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
François
Top achievements
Rank 1
Share this question
or