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

[Solved] A Bug in Advanced Form Template Example

4 Answers 212 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Nick S
Top achievements
Rank 1
Nick S asked on 18 Nov 2009, 11:37 PM
Hi,
    I used this example to customize the advanced form http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx
  When opening a recurrence event or an all day event more than one time (open the advance form then close and then re-open), the recurrence checkbox is still checked, but it doesn't expand to show the recurrence options.  If it's an all day event, the all day checkbox is checked, but the Start Time and End Time are still shown up. 
Does anybody have a workaround for that?  It seems like it's a Javascript problem from the example.
Thank you

4 Answers, 1 is accepted

Sort by
0
Accepted
Burl
Top achievements
Rank 2
answered on 19 Nov 2009, 02:06 AM
Hi Nick,

I had the same problem. Telerik confirmed the problem in one of my support tickets, here is the workaround. Make the following modification in the OnClientFormCreated handler: This solved the problem for me.

Fix to add:
 // Remove the template object from the dictionary on dispose.      
            scheduler.add_disposing(function() {      
                schedulerTemplates[templateKey] = null;      
            });   
 

Full method with fix:
// Dictionary containing the advanced template client object   
// for a given RadScheduler instance (the control ID is used as key).   
var schedulerTemplates = {};   
     
function schedulerFormCreated(scheduler, eventArgs) {   
    // Create a client-side object only for the advanced templates   
    var mode = eventArgs.get_mode();   
    if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||   
        mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {   
        // Initialize the client-side object for the advanced form   
        var formElement = eventArgs.get_formElement();     
        var templateKey = scheduler.get_id() + "_" + mode;   
        var advancedTemplate = schedulerTemplates[templateKey];   
        if (!advancedTemplate)   
        {   
            // Initialize the template for this RadScheduler instance   
            // and cache it in the schedulerTemplates dictionary   
            var schedulerschedulerElement = scheduler.get_element();   
            var isModal = scheduler.get_advancedFormSettings().modal;   
            advancedTemplate = new window.SchedulerAdvancedTemplate(schedulerElement, formElement, isModal);   
            advancedTemplate.initialize();   
     
            schedulerTemplates[templateKey] = advancedTemplate;   
     
            // Remove the template object from the dictionary on dispose.   
            scheduler.add_disposing(function() {   
                schedulerTemplates[templateKey] = null;   
            });   
        }   
     
        // Are we using Web Service data binding?   
        if (!scheduler.get_webServiceSettings().get_isEmpty()) {   
            // Populate the form with the appointment data   
            var apt = eventArgs.get_appointment();   
            var isInsert = mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert;   
            var editSeries = eventArgs.get_editingRecurringSeries();   
            advancedTemplate.populate(apt, isInsert, editSeries);   
        }   
    }   

0
Nick S
Top achievements
Rank 1
answered on 19 Nov 2009, 06:41 PM
Thanks very much Burl.  Your answer works very well!  wonder why Telerik doesn't update their example
0
Kevin Price
Top achievements
Rank 1
answered on 16 Mar 2010, 06:21 PM
Oddly enough, the fix isn't working for me. Based on the advanced form example, I have "rooms" showing on a day view. If I cancel a function and then attempt to add a new appointment, I get the duplicate objects error from JavaScript. Update - this works fine if I use the TelerikScriptManager and not the asp:ScriptManager.
0
Mike
Top achievements
Rank 2
answered on 17 Mar 2010, 05:45 PM
You're a lifesaver Burl. 
Tags
Scheduler
Asked by
Nick S
Top achievements
Rank 1
Answers by
Burl
Top achievements
Rank 2
Nick S
Top achievements
Rank 1
Kevin Price
Top achievements
Rank 1
Mike
Top achievements
Rank 2
Share this question
or