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

Set Appointment Description in Javascript

2 Answers 89 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 17 Feb 2011, 02:33 AM
All,

Can you please inform me how I can populate the appointment description field thru Javascript.

I have everything working for all other fields except description.  When i double click on the appointment , the advance form does display the description field but it is empty.
I am writing the appointments to am XML file, I see entries for <description></description> , once again blank.

Any advise would be helpful.
function rowDropping(sender, args) {
       // Fired when the user drops a grid row
       var htmlElement = args.get_htmlElement();
       var scheduler = $find('<%= RadScheduler1.ClientID %>');
       var tree = $find('<%= RadTreeView1.ClientID %>');
       var login = $find('<%= LoginName1.ClientID %>');
       var node = tree.get_selectedNode();
       var treenode = tree.get_selectedNode();
       //alert(treenode.get_attributes().getAttribute("Park"));
       var park = treenode.get_attributes().getAttribute("Park");
       if (isPartOfSchedulerAppointmentArea(htmlElement)) {
           // The row was dropped over the scheduler appointment area
           // Find the exact time slot and save its unique index in the hidden field
           var timeSlot = scheduler._activeModel.getTimeSlotFromDomElement(htmlElement);
           //args.get_htmlElement("TargetSlotHiddenField").value = timeSlot.get_index();
           // The HTML needs to be set in order for the postback to execute normally
           //args.set_htmlElement("TargetSlotHiddenField");
           var newAppointment = new Telerik.Web.UI.SchedulerAppointment(); 
           var startTime = timeSlot.get_startTime();
           var endTime = new Date(startTime);
           endTime.setMinutes(endTime.getMinutes() + 30);
           var subject = node.get_text();                    
           newAppointment.set_start(startTime); // This populates
           newAppointment.set_end(endTime); // This populates
           newAppointment.set_subject(subject); // This  populates
           newAppointment.set_description("hello"); // Does not  populate
           newAppointment.set_borderColor("Green"); // Does not change
           newAppointment.set_backColor("DarkGreen");  // Does not  change
           scheduler.insertAppointment(newAppointment);
 
       }

2 Answers, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 17 Dec 2013, 12:32 PM
SAME PROBLEM !
0
Hristo Valyavicharski
Telerik team
answered on 20 Dec 2013, 12:43 PM
Hi,

You could set description in the OnClientFormCreated event: 
function OnClientFormCreated(sender, args) {
    var mode = args.get_mode();
    if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||
        mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
        var descriptionJQueryObject = $telerik.$("[id$='Form_Description']");
        var descriptionRadTextBoxObject = $find(descriptionJQueryObject.attr("id"));
        descriptionRadTextBoxObject.set_value("Add more details about the appointment here.");
    }
}

Sample is attached.

Regards,
Hristo Valyavicharski
Telerik
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 the blog feed now.
Tags
Scheduler
Asked by
Stephen
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or