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

Get appointment resource in client side

2 Answers 110 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jonathan Levy
Top achievements
Rank 1
Jonathan Levy asked on 16 Apr 2009, 11:35 AM
Hi

I'd like to get the resource for the selected appointment in the client side. i.e. when I click to insert a new appointment or edit an existing appointment I want to be able to get the resource associated with the appointment. I currently get the appointment like this eventArgs.get_appointment(), is there a way for me to do something like eventArgs.get_appointment().get_resource() ?

Thanks
Jon

2 Answers, 1 is accepted

Sort by
0
Accepted
Genady Sergeev
Telerik team
answered on 20 Apr 2009, 10:43 AM
Hi Jonathan Levy,

When inserting an appointment you cannot get the associated resources because there aren't any, i.e. the appointment is not yet created. When editing an appointment, you can obtain the associated resources the following way ( imagine you have resource called "Room")

function appointmentEditing(sender, args) { 
            var text = args.get_appointment().get_resources().getResourcesByType("Room").getResource(0).get_text();  
        } 

As well as using the getResourceByType method, you may find the following method useful:
.getResource (index), returns collection of associated resources

For your convenience I have attached sample project reproducing the desired functionality.

Regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jonathan Levy
Top achievements
Rank 1
answered on 20 Apr 2009, 03:43 PM
Hi Genady

Thanks for that. I also came across this which seems to work.

contextMenuSlot.get_resource().get_key()

It returns the ID of the resource which is good because I can then do somethings with it.

Cheers
Jon

Tags
Ajax
Asked by
Jonathan Levy
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Jonathan Levy
Top achievements
Rank 1
Share this question
or