Hi,
I am trying to add a ClientSide Event on the MCV Schedule control.
The event fires ok and I reach my javascript function, however how do I access the text of the "Subject" element of the Appointment that the user double clicked on?
I tried the below in an alertbox but the subject is returned as null, even though I am sure there is text in the subject.
If the user clicks an appointment with a certain value in the subject I wish to display a pop-up, else I wish to re-direct the user to a custom form. Is this possible?
VIEW
<div> @(Html.Syncfusion().Schedule("Diary", "ScheduleModel") .BindList(columns => { columns.IdField("SlotId"); columns.SubjectField("DiarySubject"); columns.StartTimeField("EntryDt"); columns.EndTimeField("EntryEndDT"); columns.OwnerField("OwnerResource"); columns.CategorizeField("Category"); }) .Resources((List<ScheduleResource>)ViewData["resources"]) .AllowAddNew(false) .AllowDelete(false) .AllowDragAndDrop(false) .AllowResize(false) .AllowRecurrence(false) .AllowReminder(false) .AllowPriority(false) .AllowMultipleResource(true) .BusinessStartHour(8) .BusinessEndHour(18) .CellWidth(200) .ClientSideOnAppointmentDoubleClick("onCellDblClick") .EndHour(18) .Height(650) .HighlightBusinessHours(true) .ShowPrint(false) .StartHour(8) .ShowAppointmentIndicator(false) .ShowReminderWindow(false) .ShowContextMenu(true) .ShowTimeZonesButton(false) .ShowResourceHeader(true) .ShowWorkweekView(false) .Skins(ScheduleSkins.Metro) .TimeMode(ScheduleTimeMode.Hours24) .Width(850) ) </div>
JAVASCRIPT
function onCellDblClick(sender, args) { args.cancel = true; alert(sender.GetSubject()[args._id]);
}
Hi Uma,
Although I can now successfully access one appointment, it appears to always be the same appointment no matter what appointment I double click on. The problem seems to be that args._id is always passed into the function with the value 0, hence the same appointment is being retrieved no matter what appointment is clicked on by the user. Can you advise? Not sure if this makes a difference but I am using multiple resources on the schedule.
I am running Essential Studio Enterprise Edition 2012 volume 4 (10.4.0.53), on Visual Studio 2010 SP1 in a asp.net MVC 3 razor project on .net 4.0
Hi MacMillan,
It doesn’t make any difference using multiple resources on the schedule, while accessing an appointment and also we are unable to reproduce the reported problem. Therefore, we have prepared a simple sample, demonstrating the retrieval of fields of an appointment, on which the user double clicks. The sample can be downloaded from the below link:
Kindly try the above sample and let us
know whether you are able to reproduce the reported problem in it. If not,
kindly try to reproduce the reported problem in the above sample, so that we
could sort out the issue and provide you with exact solution.
Regards,
Uma Maheswari C
Hi MacMillan,
We would like to inform you that
the client side event “ClientSideOnActionBegin” is firing
correctly before the Ajax post takes place. To illustrate this, we have worked
on a sample and provided the screenshot describing the working of the “ClientSideOnActionBegin” event and the same can be downloaded from the below link:
We have used the following code snippet
to illustrate the attached screenshot:
@{ Html.Syncfusion().Schedule("MySchedule",
"ScheduleModel")
.DataSource(Model)
.AllowMultipleResource(true)
.ShowResourceHeader(true)
.Resources((List<ScheduleResource>)ViewData["resources"])
.BindList(bind =>
{
bind.IdField("Id");
bind.SubjectField("Subject");
bind.LocationField("Location");
bind.StartTimeField("StartTime");
bind.EndTimeField("EndTime");
bind.DescriptionField("Description");
bind.OwnerField("Owner");
bind.ReminderField("Reminder");
bind.AllDayField("AllDay");
})
.ClientSideOnActionBegin("ActionBegin")
.ClientSideOnActionSuccess("ActionEnd")
.Render();
}
Script:
<script type="text/javascript">
function
ActionBegin(sender, args) {
Sys.Debug.trace("Action begin");
// Code to display the Syncfusion
waiting popup control.
}
function ActionEnd(sender, args) {
Sys.Debug.trace("Action Successfully ended");
// Code to hide the waiting popup
control.
}
</script>
Also, it is
possible to display the Syncfusion waiting popup control while the action
begins, just by including the required code in the above code snippet.
Kindly, try
the code and let us know, if you have any other concerns.
Thanks,
Uma
Maheswari C
Hi Uma,
The below code should illustrate the issue. Note if you click between the day and month view you will see the WaitingPopup will not appear. If however you comment out the code in the javascript function "onActionComplete" and re-run the test you will see that the waiting popup control does appear... but only after the calendar content has returned and loaded, it does not display "During" loading. (Note high transparency rate to illustrate the point).
I
have also tried doing this with JavaScript and a Canvas element in HTML5,
with the same results
<div id="MainDiaryDiv"> <div id="targetArea" class="DiaryAjaxTargetArea" > @{Html.Syncfusion().Schedule("Diary", "ScheduleModel") .DataSource(Model) .BindList(columns => { columns.IdField("DteId"); columns.SubjectField("DiarySubject"); columns.StartTimeField("EntryDt"); columns.EndTimeField("EntryEndDT"); columns.OwnerField("OwnerResource"); columns.CategorizeField("Category"); columns.DescriptionField("Description"); }) .Resources((List<ScheduleResource>)ViewData["resources"]) .AppointmentTemplateName("AppTemplate") .AllowAddNew(false) .AllowDelete(true) .AllowDragAndDrop(true) .AllowResize(false) .AllowRecurrence(false) .AllowReminder(false) .AllowPriority(false) .AllowMultipleResource(true) .AllowKeyboardNavigation(true) .AllowEdit(false) .AllowInline(false) .BusinessStartHour(8) .BusinessEndHour(18) .CellWidth(200) .ClientSideOnAppointmentDoubleClick("onCellDblClick") .EndHour(18) .FirstDayOfWeek(DayOfWeek.Monday) .Height(650) .HighlightBusinessHours(true) .ClientSideOnActionBegin("onActionStart") .ClientSideOnActionSuccess("onActionComplete") .ShowPrint(false) .StartHour(8) .ShowAppointmentIndicator(false) .ShowReminderWindow(false) .ShowContextMenu(true) .ShowTimeZonesButton(false) .ShowResourceHeader(true) .ShowWorkweekView(false) .ShowMonthView(false) .ShowToolTip(false) .ShowTodayView(false) .Skins(ScheduleSkins.Metro) .TimeMode(ScheduleTimeMode.Hours24) .Width(850) .Render(); } </div> @{Html.Syncfusion().WaitingPopup("myPopup").TargetId("targetArea").ShapeHeight(650).ShapeWidth(850).EnableHTML5(true).Render(); } </div>
JAVA Script
function onActionStart() { Sys.Debug.trace("Action begin"); var waitingObj = $find("myPopup"); waitingObj.SetBackgroundColor("Blue"); waitingObj.SetTransparency(1); waitingObj.ShowPopUp(); } function onActionComplete() { Sys.Debug.trace("Action Successfully ended"); var waitingObj = $find("myPopup"); waitingObj.HidePopUp(); }
We regret for the inconvenience caused and also for the delay.
We are able to reproduce the issue with "Rendering waiting popup" and we suspect this issue to be a defect. We
thank you for bringing this to our attention. To facilitate tracking the
progress of the fix we request you to create an incident in our incident
database Direct Trac.
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents
Regards,
Uma Maheswari C