Unable to determind start time on resized appointment

4 posts, 1 answers
  1. Clyde
    Clyde avatar
    41 posts
    Member since:
    Feb 2008

    Posted 15 Oct 2012 Link to this post

    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
  2. Answer
    Plamen
    Admin
    Plamen avatar
    2954 posts

    Posted 18 Oct 2012 Link to this post

    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.
  3. Clyde
    Clyde avatar
    41 posts
    Member since:
    Feb 2008

    Posted 18 Oct 2012 Link to this post

    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
  4. Plamen
    Admin
    Plamen avatar
    2954 posts

    Posted 19 Oct 2012 Link to this post

    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.
Back to Top