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

Missing resource attributes on client side

1 Answer 118 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
mgs
Top achievements
Rank 1
mgs asked on 11 Oct 2011, 03:07 PM
Hi,

I'm using the scheduler control in TimelineView only. I set the following custom attributes on resources server side in the OnDataBound event, example:

 

 

resource.Attributes.Add("StartTime", "08:00"); 
resource.Attributes.Add("EndTime", "16:00");

 


These are the start time and end time of each individual resource's working hours, and are in my code loaded from a database. These attributes are used server side in the OnTimeSlotCreated event successfully.

In my application, I need to check if an appointment is moved outside of the resource's working hours, and then display a javascript alert warning the user from the OnClientAppointmentMoveEnd event.

From my JavaScript, if I attemp the following I am able to retrive the attributes correctly:

 

 

var startTime = scheduler.get_resources().getResource(0).get_attributes().getAttribute("StartTime");

If I attempt to retrieve the attributes from the event arguments using the following code, the attributes don't exist:
 

var startTime = eventArgs.get_targetSlot().get_resource().get_attributes().getAttribute("StartTime");

If I call the following function, I am able to get the resource correctly, it's just the attributes that are blank:

var resource = eventArgs.get_targetSlot().get_resource();

Is there any way i can retrive my resource attributes successfully from the event arguments or from the scheduler.get_resources() based on the resource key? Optionally, how can i find the index of a resource from the resource collection by the resource key so I can use the getResource(index) function?

I'm using version 2011.1.413.40.

Thanks

 

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 14 Oct 2011, 01:14 PM
Hello Mgs,

I have prepared a sample web page for you, which shows how the resources defined for the RadScheduler could be accessed in client-side code using the RadScheduler client-side object and the clicked appointment.
The sample page is attached to the message, you can download it and give it a try.

Hope this helps.

All the best,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Scheduler
Asked by
mgs
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or