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

Scheduler commands

7 Answers 280 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Julia Shah
Top achievements
Rank 1
Julia Shah asked on 01 Dec 2009, 12:25 AM
Hi,

The latest version of the scheduler (Q3 2009) offers new context menu feature, which is great. The only problem that I am having is that command names changed since the previous version ("QuickInsert" is now "CommandAddAppointment"). Is there a list of all the built-in commands somewhere? I am trying to build a context menu with "Quick insert", "Detailed insert", "Insert recurring event", etc., but I don't know what commands to use. I don't think the demo http://demos.telerik.com/aspnet-ajax/scheduler/examples/contextmenu/defaultcs.aspx lists all the available commands, does it?

Thanks,
Julia

7 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 01 Dec 2009, 03:00 PM
Hi Julia,

The online demo lists all the special values for the menu items. There is just one typo I spotted:

AddRecurringAppointment should be - CommandAddRecurringAppointment

For more detailed information you can see the help topics:

http://www.telerik.com/help/aspnet-ajax/scheduler-appointment-context-menu.html

http://www.telerik.com/help/aspnet-ajax/scheduler-timeslot-context-menu.html



Kind regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Julia Shah
Top achievements
Rank 1
answered on 01 Dec 2009, 04:10 PM
OK, I will re-phrase my question. I want to build a context menu like this:

On time slot:
- Add event (inline insert form)
- Add event details (advanced insert form)
- Add recurring event (advanced insert with recurrence)

On appointment:
- Edit (inline edit form)
- Edit event details (advanced edit form)
- Edit recurring event (advanced edit with recurrence)

How do I do that?

<TimeSlotContextMenus> 
    <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerTimeSlotContextMenu">  
        <Items> 
            <telerik:RadMenuItem Text="Add event" Value="CommandAddAppointment" /> 
            <telerik:RadMenuItem Text="Add event details" Value="?" /> 
            <telerik:RadMenuItem Text="Add recurring event" Value="CommandAddRecurringAppointment" /> 
        </Items> 
    </telerik:RadSchedulerContextMenu>   
</TimeSlotContextMenus> 
 
<AppointmentContextMenus> 
    <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerAppointmentContextMenu">  
        <Items> 
            <telerik:RadMenuItem Text="Edit" Value="CommandEdit" /> 
            <telerik:RadMenuItem Text="Edit event details" Value="?" /> 
            <telerik:RadMenuItem Text="Edit recurring event" Value="?" /> 
        </Items> 
    </telerik:RadSchedulerContextMenu> 
</AppointmentContextMenus> 
 

Thanks,
Julia
0
Peter
Telerik team
answered on 02 Dec 2009, 04:16 PM
Hi Julia,

This makes it clearer. For all other times which don't have special commands, you should handle the following RadScheduler's events:

OnAppointmentContextMenuItemClicked
OnTimeSlotContextMenuItemClicked
OnAppointmentContextMenuItemClicking
OnTimeSlotContextMenuItemClicking

For example:
protected void RadScheduler1_TimeSlotContextMenuItemClicking(object sender, TimeSlotContextMenuItemClickingEventArgs e)
       {
           if (e.MenuItem.Value == "EnableGrouping")
           {
               RadScheduler1.GroupBy = "Calendar";
           }
           else if (e.MenuItem.Value == "DisableGrouping")
           {
               RadScheduler1.GroupBy = "";
           }
       }



Kind regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Moroianu George-Gabriel
Top achievements
Rank 1
answered on 22 Feb 2010, 01:22 PM
I have a similar problem and i wonder if you can help me too. I did two functions which will  open an modal radwindow for "OnClientAppointmentEditing" and "OnClientAppointmentInserting". The edit menu is working ok, when i click EDIT the modal page is open , everything is ok, but with Insert faze i have a problem. The problem is that the command "CommandAddAppointment" is stratinge the usual menu of add scheduler and is not calling the function i gave for "OnClientAppointmentInserting". I am doing something wrong? Actually, I am sure that i am doing something wrong but where and how i solve this.
My code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="admini.aspx.vb" Inherits="TEST_admini" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
     
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"
        </telerik:RadScriptManager> 
     
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadScheduler1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadScheduler1"  
                            LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
     
        <telerik:RadScheduler ID="RadScheduler1" runat="server"  
            DataDescriptionField="Subtitle" DataEndField="NewsType_DeadLine"  
            DataKeyField="NewsID" DataSourceID="ObjectDataSource1"  
            DataStartField="PublishDate" DataSubjectField="Title" Height="" 
            StartEditingInAdvancedForm="False"  
            onclientappointmentediting="AppointmentEditing"  
            onclientappointmentinserting="AppointmentInserting" Skin="Black"  
            EnableCustomAttributeEditing="True" StartInsertingInAdvancedForm="False"
            <AdvancedForm EnableCustomAttributeEditing="True" /> 
            <Localization AdvancedEditAppointment="Edit News"  
                AdvancedNewAppointment="Insert News" ContextMenuAddAppointment="Insert News"  
                ContextMenuDelete="Delete News" ContextMenuEdit="Edit News" /> 
 
                <AppointmentContextMenus> 
             <%--The appointment context menu interaction is handled on the client in this example--%> 
             <%--See the JavaScript code above--%> 
                <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerAppointmentContextMenu"
                    <Items> 
                        <telerik:RadMenuItem Text="Edit News" Value="CommandEdit" /> 
                        <telerik:RadMenuItem IsSeparator="True" /> 
                       <telerik:RadMenuItem Text="Delete" Value="CommandDelete"  /> 
                    </Items> 
                </telerik:RadSchedulerContextMenu> 
                </AppointmentContextMenus> 
 
                 <TimeSlotContextMenuSettings EnableDefault="True" /> 
 
                 <TimeSlotContextMenus> 
                <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerTimeSlotContextMenu"
                    <Items> 
                        <telerik:RadMenuItem Text="Insert News"  Value="CommandAddAppointment" /> 
                                               <%-- Custom command --%> 
                        <telerik:RadMenuItem IsSeparator="true" /> 
                        <telerik:RadMenuItem Text="Go to today" Value="CommandGoToToday" /> 
                    </Items> 
                </telerik:RadSchedulerContextMenu>  
            </TimeSlotContextMenus> 
 
 
 
 
 
 
        </telerik:RadScheduler> 
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"  
            SelectMethod="NewsSchedulerList" TypeName="NewsSpace.News_DB"
            <SelectParameters> 
                <asp:Parameter Name="NewsID" Type="Int32" /> 
            </SelectParameters> 
        </asp:ObjectDataSource> 
     
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"  
            Skin="Default"
            &quot;Loading...&quot; 
            <telerik:RadWindowManager ID="AdvancedForm" runat="server"  
                Behaviors="Resize, Move" Modal="True" onclientclose="refreshScheduler"  
                ReloadOnShow="True" Title="News Administration" AutoSize="True" Skin="Black"  
                Width="800px" BorderStyle="None" KeepInScreenBounds="True"
            </telerik:RadWindowManager> 
        </telerik:RadAjaxLoadingPanel> 
     
    </div> 
    </form> 
    <script type="text/javascript"
        function AppointmentEditing(sender, eventArgs) { 
            var apt = eventArgs.get_appointment(); 
            window.radopen("admin.aspx?Mode=Edit&NewsId=" + apt._id, "AdvancedForm"); 
            eventArgs.set_cancel(true); 
        } 
 
        function AppointmentInserting(sender, eventArgs) { 
            var start = formatDate(eventArgs.get_startTime()); 
            var isAllDay = eventArgs.get_isAllDay(); 
            // New appointment 
            window.radopen("admin.aspx?Mode=Insert&Start=" + start + "&IsAllDay=" + isAllDay, "AdvancedForm"); 
            eventArgs.set_cancel(true); 
        } 
 
        function formatDate(date) { 
            var year = padNumber(date.getUTCFullYear(), 4); 
            var month = padNumber(date.getUTCMonth() + 1, 2); 
            var day = padNumber(date.getUTCDate(), 2); 
            var hour = padNumber(date.getUTCHours(), 2); 
            var minute = padNumber(date.getUTCMinutes(), 2); 
            return day + "/" + month + "/" + year + " " + hour + ":" + minute; 
//            return year + month + day + hour + minute; 
        } 
 
        function padNumber(number, totalDigits) { 
            numbernumber = number.toString(); 
            var padding = ''
            if (totalDigits > number.length) { 
                for (i = 0; i < (totalDigits - number.length); i++) { 
                    padding += '0'; 
                } 
            } 
 
            return padding + number.toString(); 
        } 
 
        function refreshScheduler() { 
            var ajaxManager = $find("RadAjaxManager1"); 
            ajaxManager.ajaxRequest('RebindScheduler'); 
        } 
     
    </script> 
</body> 
</html> 
 
Thank you for help,
Moro
0
Peter
Telerik team
answered on 23 Feb 2010, 02:11 PM
Hello Moroianu,

Indeed, 'CommandAddAppointment' is a reserved word for the time slot context menu. I suggest you use a slightly different approach and handle OnClientTimeSlotContextMenuItemClicking. Please, try the following code and let me know if it helps you accomplish your goal:
<telerik:RadScheduler ID="RadScheduler1" 
       runat="server" SelectedView="MonthView" 
       OnClientTimeSlotContextMenuItemClicking="OnClientTimeSlotContextMenuItemClicking" >
       <TimeSlotContextMenuSettings EnableDefault="True" />
       <TimeSlotContextMenus>
           <telerik:RadSchedulerContextMenu runat="server"  ID="SchedulerTimeSlotContextMenu">
               <Items>
                   <telerik:RadMenuItem Text="Insert News" Value="InsertAppointment" />
                   <%-- Custom command --%>
                   <telerik:RadMenuItem IsSeparator="true" />
                   <telerik:RadMenuItem Text="Go to today" Value="CommandGoToToday" />
               </Items>
           </telerik:RadSchedulerContextMenu>
       </TimeSlotContextMenus>
   </telerik:RadScheduler>
   <script type="text/javascript">
       function OnClientTimeSlotContextMenuItemClicking(sender, eventArgs) 
       {
           if (eventArgs.get_item().get_value() == "InsertAppointment") {
               alert("insert appointment");
           }
       }
   </script>

The value 'InsertAppointment' is randomly chosen, but we need it to check which item was clicked.


All the best,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Moroianu George-Gabriel
Top achievements
Rank 1
answered on 23 Feb 2010, 04:58 PM
Thnak you for your help,
But I have now another problem. To raise the modal window and to send the start data to insert page i need to get the 
"var start = formatDate(eventArgs.get_startTime());" value. Calling the function from "OnClientTimeSlotContextMenuItemClicking" function from your example, i loose the eventArgs and the error i received is "Object doesn't support this property or method" with reference on start variable. Practically the get_statTime() is missing from eventArgs. How can i make it right?. I must mention that using double click , direct OnClientAppointmentInserting it works. 
Here are my functions:
 function AppointmentInserting(sender, eventArgs) { 
 
                var start = formatDate(eventArgs.get_startTime()); 
                var isAllDay = eventArgs.get_isAllDay(); 
                // New appointment 
               window.radopen("admin.aspx?Mode=Insert&Start=" + start + "&IsAllDay=" + isAllDay, "AdvancedForm"); 
                            eventArgs.set_cancel(true); 
             
        } 
        function formatDate(date) { 
            var year = padNumber(date.getUTCFullYear(), 4); 
            var month = padNumber(date.getUTCMonth() + 1, 2); 
            var day = padNumber(date.getUTCDate(), 2); 
            var hour = padNumber(date.getUTCHours(), 2); 
            var minute = padNumber(date.getUTCMinutes(), 2); 
            return day + "/" + month + "/" + year + " " + hour + ":" + minute; 
 
        } 
 
        function padNumber(number, totalDigits) { 
            numbernumber = number.toString(); 
            var padding = ''
            if (totalDigits > number.length) { 
                for (i = 0; i < (totalDigits - number.length); i++) { 
                    padding += '0'; 
                } 
            } 
 
            return padding + number.toString(); 
        } 
 
        function refreshScheduler() { 
            var ajaxManager = $find("RadAjaxManager1"); 
            ajaxManager.ajaxRequest('RebindScheduler'); 
        } 
        function OnClientTimeSlotContextMenuItemClicking(sender, eventArgs) { 
            if (eventArgs.get_item().get_value() == "InsertAppointment") { 
         // alert("insert appointment"); 
                //  AppointmentInserting(); 
               
                AppointmentInserting(sender, eventArgs); 
            } 
        } 
Thank you again for your trouble,
Yours,
 Moro
0
Peter
Telerik team
answered on 25 Feb 2010, 10:09 AM
Hello Moroianu,

You should first access the time slot object with get_slot() and then use the get_startTime() method - eventArgs.get_slot().get_startTime().

Here is the client-side help topic for reference: SchedulerTimeSlot and SchedulerModel


Kind regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Scheduler
Asked by
Julia Shah
Top achievements
Rank 1
Answers by
Peter
Telerik team
Julia Shah
Top achievements
Rank 1
Moroianu George-Gabriel
Top achievements
Rank 1
Share this question
or