OnClientAppointmentMoveEnd fires twice

3 posts, 0 answers
  1. Ei Wai
    Ei Wai avatar
    56 posts
    Member since:
    Jul 2014

    Posted 12 Aug 2014 Link to this post


    I am using telerik version 2013.3.1324.35. I used scheduler with multiple resources. I use OnClientAppointmentMoveEnd to get the resource when they moved the slot. Below is the function I am using. It seems like function is calling twice. When first time fires, I can get the correct tutor. But on second time , it seems like it is getting the original tutor before moving. Is there anything I can do?  Thanks in advance.

    function OnClientAppointmentMoveEnd(sender, eventArgs) {
                   var appointment = eventArgs.get_appointment();
                   var recurrState = appointment.get_recurrenceState();
                   var slotElement = $telerik.$(eventArgs.get_targetSlot().get_domElement());
                   $get('<%= hid_oldstart.ClientID %>').value = formatDate(appointment.get_start());
                   $get('<%= hid_oldend.ClientID %>').value = formatDate(appointment.get_end());
                   if (slotElement.is(".Disabled") || slotElement.parent().is(".Disabled")) {
                   // Calculate the duration of the appointment
                   var appointmentDuration = appointment.get_end() - appointment.get_start();
                   // The new start time is provided in the event arguments              
                   var newStartTime = eventArgs.get_newStartTime();
                   // Add the duration of the appointment to the new start time to get the new end time
                   var newEndTime = new Date(newStartTime.getTime() + appointmentDuration);
                   var editSeries = eventArgs.get_editingRecurringSeries();
                   if (slotElement.is(".Disabled") || slotElement.parent().is(".Disabled") || slotElement.is(".ReasonDisabled") || slotElement.parent().is(".ReasonDisabled")) {
                       radalert('Moving appointment to this slot is not allowed'
                           , 330, 180, 'Warning!', alertCallBackFn, imgUrl); return false;
                   else {
                       var list = appointment.get_attributes();
                       var attr = list.getAttribute('TutorID');
                       var targetResource = eventArgs.get_targetSlot().get_resource();
                       var newTutor = targetResource.get_key();
                       attr = newTutor;
                       var aptAttributes = appointment.get_attributes();
                       aptAttributes.setAttribute("TutorID", newTutor);
                       var state = appointment.get_recurrenceState();
                       $get('<%= hid_movedendStd.ClientID %>').value = formatDate(newStartTime);
                       $get('<%= hid_moveendEtd.ClientID %>').value = formatDate(newEndTime);
                       $get('<%= hid_moveendTutor.ClientID %>').value = newTutor;
                       var myarr = new Array();
                       myarr[0] = "movedend";
                       myarr[1] = formatDate(newStartTime);
                       myarr[2] = formatDate(newEndTime);
                       myarr[3] = newTutor;
                       $find("<%=RadAjaxManager1.ClientID %>").ajaxRequest(myarr);

    Best regards,
  2. Dimitar Terziev
    Dimitar Terziev avatar
    1268 posts

    Posted 14 Aug 2014 Link to this post


    I have tried to reproduce the experienced issue, but to no avail. The AppointmentMoveEnd event is fired only once per move operation. Attached is the sample page I have tested with.

    Dimitar Terziev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Ei Wai
    Ei Wai avatar
    56 posts
    Member since:
    Jul 2014

    Posted 19 Aug 2014 in reply to Dimitar Terziev Link to this post


    Thanks for the sample. I found out that it is because of my program bug. Thanks again for your kind assistance.

    Best regards,
Back to Top