Missing resource attributes on client side

2 posts, 0 answers
  1. mgs
    mgs avatar
    2 posts
    Member since:
    May 2011

    Posted 11 Oct 2011 Link to this post


    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.



  2. Ivana
    Ivana avatar
    657 posts

    Posted 14 Oct 2011 Link to this post

    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,
    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
Back to Top