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

Get EndTime When Updating Apointment - Client Side

5 Answers 95 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 16 Feb 2009, 03:18 PM
Hi guys,

I am trying to get the endtime of the appoitment on OnClientAppointmentMoveEnd client-side event.

The idea is that I want to restrict the user from bypassing the business hours set ( 9am - 6pm) while he is updating the apointment from client side.

I have the code to cancel the event but I am not able to find the new endtime of the appointment when he finishes dragging.

   function appointmentMoveEnd(sender, args) { 
 
 
             debugger; 
             var targetSlot = args.get_targetSlot(); 
             var startTime = targetSlot.get_startTime(); 
             var startTime = targetSlot.get_startTime(); 
             var appointment = args.get_appointment();  
             var originalStartTime = appointment.get_start(); 
 
             var newHour = originalStartTime.getHours(); 
             var newMinute = originalStartTime.getMinutes(); 
             var newSecond = originalStartTime.getSeconds(); 
              
              
 
             startTime.setHours(newHour); 
             startTime.setMinutes(newMinute); 
             startTime.setSeconds(newSecond); 
 
             var endTime = new Date(startTime.getTime() + appointment._getDuration()); 
              
              
             var date = args.get_appointment().get_end(); 
             alert(date); 
                 args.get_appointment().get_element().style.border = "1px solid Orange"
                 args.set_cancel(true); 
            
         } 

The above code is just an experimentation.

I just want to get the new endtime and see if the end time is outside the business hours so I can cancel updating.

--------------------------------

Other question :

In the scheduler, I want to make MinutesperRow = 60 and show each hour displayed in one row Like :

8am
9am
10am
....


Each hour shows one Row only of 60 minutes


Thanks a lot.

5 Answers, 1 is accepted

Sort by
0
Joseph
Top achievements
Rank 1
answered on 17 Feb 2009, 01:16 PM
Any Suggestions guys?
0
Joseph
Top achievements
Rank 1
answered on 18 Feb 2009, 02:59 PM
Any ideas guys?
0
Accepted
Peter
Telerik team
answered on 19 Feb 2009, 05:33 PM
Hello Joseph,

We will expose a mehod to get the new end time of the appointment on the client. Meanwhile, please use the following workaround:
<script type="text/javascript">  
        function OnClientAppointmentMoveEnd(sender, eventArgs) {  
 
            var durationInMinutes = eventArgs.get_appointment().get_duration() / 60000;  
            var appMinutes = eventArgs.get_newStartTime().getMinutes();  
            eventArgs.get_newStartTime().setMinutes(durationInMinutes + appMinutes);  
 
 
            alert("The new end time is: " + eventArgs.get_newStartTime());  
            
             
        }  
    </script> 


All the best,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Joseph
Top achievements
Rank 1
answered on 04 Mar 2009, 01:25 PM
Thanks for the code.

You should only modify the first line to become :

var durationInMinutes = eventArgs._appointment._getDuration() / 60000;   

Regrads,

Joseph
0
Peter
Telerik team
answered on 05 Mar 2009, 05:10 PM
Hello Joseph,

Probably you are using an older version and that is why you had to modify your code. With the current version, you can use the public client side methods - get_appointment() and get_duration().


All the best,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Scheduler
Asked by
Joseph
Top achievements
Rank 1
Answers by
Joseph
Top achievements
Rank 1
Peter
Telerik team
Share this question
or