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

onAppointmentMoveEnd target time

1 Answer 17 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Developer
Top achievements
Rank 1
Developer asked on 17 Sep 2013, 10:07 AM
Hi, i am trying to make a confirmation box when moving an appointment.
The problem here is that the:
args.get_targetSlot().get_startTime().format("HH:mm");

returns wrong time, wye is that?

function onAppointmentMoveEnd(sender, args) {
           
           var appointment = args.get_appointment();
           var scheduler = $find("<%= RadScheduler1.ClientID %>");
 
           var fromTime = appointment.get_start();
 
           var customerName = appointment.get_resources().getResourceByType("Kunder").get_text();
           var fromRoom = appointment.get_resources().getResourceByType("Rum").get_text();
 
           var targetRoom = args.get_targetSlot().get_resource().get_text();
 
           var targetTime = args.get_targetSlot().get_startTime().format("HH:mm");
 
           // Calculate the duration of the appointment
           var appointmentDuration = appointment.get_end() - appointment.get_start();
 
           var newFromEndTime = new Date(fromTime.getTime() + appointmentDuration);
           var editSeries = args.get_editingRecurringSeries();
            
           // Pop a confirmation window
           var confirmMessage = "Är du säker på att du vill flytta " + customerName + "?<p> <strong> Från:</strong> " + fromRoom + " <strong>kl:</strong> " + fromTime.format("HH:mm") + "<br/> <strong>Till:</strong> " + targetRoom + " <strong>kl:</strong> " + targetTime + "</p>";
 
           radconfirm(confirmMessage,
           function (arg) {
               if (arg == false) {
                   // The user has confirmed moving the appointment. Update the start and end time.
                   appointment.set_start(fromTime);
                   appointment.set_end(newFromEndTime);
                   scheduler.updateAppointment(appointment, editSeries);
               }
           }, 330, 100);
       }

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 19 Sep 2013, 01:41 PM
Hi Dick,

 
You can try to use the get_newStartTime() as for example it is done in this on-line demo

Hope this will help you solve the issue. 

Regards,
Plamen
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
Developer
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or