Pradeep Kumar

Pradeep Kumar

  • NA
  • 57
  • 1.8k

RadScheduler calling OnClientAppointmentMoveEnd twice when i try to mo

Jul 21 2020 3:08 AM
I'm facing one problem that is related to telerik RadScheduler,when I try to move appointment from one resource to another then radscheduler event called OnClientAppointmentMoveEnd javascript function twice.
I am not sure, Is there any internal thread is calling during move appointment?
Please help in this.
Any suggestions?
 
Below is the code where I'm getting confirm popup twice.
 
//Javascript function call on Rad scheduler event
function OnClientAppointmentMoveEnd1(sender, args) {
var scheduler = null;
// Cache the Scheduler object reference so we don't have to retrieve it every time
scheduler = sender;
try {
hideActiveToolTip();
if ($("#<%=hdnEditeTicket.ClientID%>").val() == 'N') {
noty({ text: 'You do not have permission!', type: 'warning', layout: 'topCenter', closeOnSelfClick: true, timeout: 1000, theme: 'noty_theme_default', closable: false, dismissQueue: true });
args.set_cancel(true);
}
else {
var appt = args.get_appointment();
var list = appt.get_attributes();
var attrAssigned = list.getAttribute('assigned');
var _NewStartDate = args.get_newStartTime();
var todaysDate = getFormattedString(_NewStartDate);
var NewTimeSlotIndex = args.get_targetSlot().get_index();
var TicketId = appt._id;
var resource = args.get_targetSlot().get_resource();
var workername = resource.get_text();
if (appt != null && list != null && attrAssigned != null && NewTimeSlotIndex != null) {
if (attrAssigned == "4") {
noty({ text: 'It is not allowed to move the completed ticket.', type: 'warning', layout: 'topCenter', closeOnSelfClick: true, timeout: 500, theme: 'noty_theme_default', closable: false, dismissQueue: true });
args.set_cancel(true);
}
else if (attrAssigned != "4") {
//This Popop is called Twice
if (confirm('Do you really want to move ' + appt._subject + ' ?')) {
//call Ajax request
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "ScheduleBoard.asmx/AppointmentMove",
data: '{ "TicketId" : "' + TicketId + '", "TimeSlotIndex": "' + NewTimeSlotIndex + '", "StartTime": "' + todaysDate + '", "workername" : "' + workername + '" }',
dataType: "json",
async: false,
success: function (data) {
console.log(data.d);
},
error: function (result) {
alert(result.responseText);
},
failure: function (result) {
alert(result.responseText);
}
});
args.set_cancel(true);
}
else {
args.set_cancel(true);
}
}
} else { args.set_cancel(true); }
}
} catch (e) { console.log(e); }
}
//RadScheduler Event
<telerik:RadScheduler ID="RadScheduler1" runat="server" Skin="Material" CssClass="RadScheduler1" RenderMode="Lightweight"
ShowHeader="true"
ShowFooter="false"
Width="99%" Height="630px" ShowNavigationPane="true"
CustomAttributeNames="id"
DisplayDeleteConfirmation="false"
AllowDelete="false"
StartEditingInAdvancedForm="false"
StartInsertingInAdvancedForm="false"
ShowAllDayRow="true"
EnableExactTimeRendering="true"
OnClientAppointmentContextMenu="OnClientAppointmentContextMenu"
OnClientAppointmentMoveEnd="OnClientAppointmentMoveEnd1"
</telerik:RadScheduler>
 

Attachment: scheduler.rar