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

Dynamically enable custom context menu items depending on date

2 Answers 49 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Bex
Top achievements
Rank 1
Bex asked on 10 Apr 2012, 10:53 AM
Hi

My appointments in my scheduler have custom context menus.

Once an appointment time has passed I want to enable one of my custom context menu items so the user can click it and fill in a feedback form for the appointment, but they are not allowed to do this until the appointment has been. 

Is there anyway of getting a reference to an appointment's context menu when an appointment is created and checking the date and enabling this item depending what it is?

I can't seem to find anything in the documentation regarding this.

Bex

2 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 11 Apr 2012, 12:47 PM
Hello Bex,

 
You can handle the OnClientAppointmentContextMenu event as it is done in the ContextMenu on-line demo and depending on the start and end of the client appointment object to modify your menu.

Hope this will help you.

Greetings,
Plamen Zdravkov
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.
0
Bex
Top achievements
Rank 1
answered on 11 Apr 2012, 01:36 PM
Thank you!
Works like a charm..
Here is what I did in case anyone else wants to do similar?

var selectedAppointment = null;
     function appointmentContextMenu(sender, eventArgs) {
         var menu = $find("<%= EventContextMenu.ClientID %>");
         selectedAppointment = eventArgs.get_appointment();
         Disable(menu, selectedAppointment);
         menu.show(eventArgs.get_domEvent());
     }
     function Disable(menu, appointment) {
         var eventType = appointment.get_resources().getResourcesByType("Type").getResource(0);
         if (!eventType)
             return;
 
         if (eventType.get_key() == 2) {
 
             var resultsItem = menu.findItemByText("feedback");
             if (appointment.get_end() < new Date()) {
                 resultsItem.enable();
             } else {
                 resultsItem.disable();
             }
 
         }
     }
Tags
Scheduler
Asked by
Bex
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Bex
Top achievements
Rank 1
Share this question
or