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

Unable to determind start time on resized appointment

3 Answers 37 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Clyde
Top achievements
Rank 1
Clyde asked on 15 Oct 2012, 06:49 PM
We have a reservation system that allows a user to insert an appointment with a maximum of 90 minute duration. They can schedule it for less time, and have the resizing capability to extend it to 90 minutes. I have the JS in place to restrict a user from extending the end time beyond the 90 minutes, but if they size from the start, there seems to be no way to effectively capture this and check the duration limit.

function warnIfTooLong(start, end, sender, args) {
    var appointment = args.get_appointment();
    var finalTime = new Date(start);
    var maxDuration = 90;
    finalTime.setMinutes(finalTime.getMinutes() + maxDuration);
    if (end > finalTime) {
        alert("You cannot reserve a court for that duration.");
        args.set_cancel(true);
    }
  
}  

This script works fine if you feed in the correct start and end times. However I have been unable to figure out how to get the new start time for a resized appointment, end time can be taken from args.get_newTime();

function onAppointmentResizeEnd(sender, args) {
 
    var start = args.get_appointment().get_start();
    var end = args.get_newTime();
 
    warnIfTooLong(start, end, sender, args);
}

Does anyone have any idea how I can get the start time correct from a resized appointment?

Many thanks
Clyde

3 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 18 Oct 2012, 02:29 PM
Hi Clyde,

Here is one possible way to achieve such functionality:

function OnClientAppointmentResizeEnd(sender, args) {
            var duration = (args.get_newEndTime() - args.get_newStartTime()) / 60000;
 
            if (duration > 90) {
                args.set_cancel(true);
            }
        }

Hope this will be helpful.
 Regards,
Plamen
the Telerik team
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 their blog feed now.
0
Clyde
Top achievements
Rank 1
answered on 18 Oct 2012, 08:17 PM
Thank you, this did solve the issue.

May I suggest an update to the documentation to list these two properties. I think it would be helpful to be able to find a reference to them there.

Thanks
Clyde
0
Plamen
Telerik team
answered on 19 Oct 2012, 05:39 AM
Hello Clyde,

 
Thank you for you r recommendation and concern with RadControls.

We will add this information to our documentation as soon as possible. 

Greetings,
Plamen
the Telerik team
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 their blog feed now.
Tags
Scheduler
Asked by
Clyde
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Clyde
Top achievements
Rank 1
Share this question
or