Thank you for your sample project. I attach an updated version that indicates the problem I am having.
You will find that I have assigned two variables.
One is the result of your controller call '/Home/GetData', the other is from my call to '/Home/GetData_Json'.
I used QuickWatch (Ctrl+D, Q) feature of VisualStudio to examine contents of two variables in the javascript function 'BtnClick()'
The structure and types of the variables 'thisData' and 'thisDataJson' are the same.
However, if I call "$("#Schedule1").ejSchedule("option", "appointmentSettings.dataSource", thisDataJson);" the programme hangs.
It works fine if I use "$("#Schedule1").ejSchedule("option", "appointmentSettings.dataSource", thisData);"
Can you see something that I am missing. As far as I can see, 'Schedule1' should display data from either variable.
Thanks
Morgan
Below is some information that might be helpful.
This is the data from thisData[0] which is the return from GetData() function in the HomeController.
- thisData [[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]] Object, (Array)
+ __proto__ [] Object, (Array)
length 8 Number
- [0] {...} Object
+ __proto__ {...} Object
AllDay false Boolean
Description undefined Undefined
+ EndTime Sun May 04 2014 04:30:00 GMT+0100 (GMT Daylight Time) Object, (Date)
Id 103 Number
Recurrence 0 Number
RecurrenceRule null Null
+ StartTime Sun May 04 2014 03:00:00 GMT+0100 (GMT Daylight Time) Object, (Date)
Subject "What Happened Next?" String
+ [1] {...} Object
+ [2] {...} Object
+ [3] {...} Object
+ [4] {...} Object
+ [5] {...} Object
+ [6] {...} Object
+ [7] {...} Object
This is the data from thisDataJson[0] which is returned from my GetData_Json() function in the HomeController.
Note that the names and types are identical (Ecxept for Description: My result is String yours is Undefined)
- thisDataJson [[object Object],[object Object]] Object, (Array)
+ __proto__ [] Object, (Array)
length 2 Number
- [0] {...} Object
+ __proto__ {...} Object
AllDay false Boolean
Description "" String
+ EndTime Mon May 05 2014 16:00:00 GMT+0100 (GMT Daylight Time) Object, (Date)
Id 100 Number
Recurrence 1 Number
RecurrenceRule "FREQ=DAILY,INTERVAL=1,COUNT=5" String
+ StartTime Mon May 05 2014 09:00:00 GMT+0100 (GMT Daylight Time) Object, (Date)
Subject "Class" String
+ [1] {...} Object
The following is an extract from HomeController.cs relating to my function 'GetData_Json()':
public JsonResult GetData_Json()
{
List<SchedulerClasses.EventItem> thisEventItems = new List<SchedulerClasses.EventItem>();
SchedulerClasses.EventItem eItem = null;
eItem = new SchedulerClasses.EventItem();
eItem.Id = 100;
eItem.Subject = "Class";
eItem.StartTime = new DateTime(2014, 5, 5, 9, 00, 00);
eItem.EndTime = new DateTime(2014, 5, 5, 16, 00, 00);
eItem.Description = "";
eItem.AllDay = false;
//eItem.Recurrence = true;
eItem.Recurrence = 1;
eItem.RecurrenceRule = "FREQ=DAILY,INTERVAL=1,COUNT=5";
eItem.categoryId = "1";
eItem.groupId = 1;
eItem.ownerId = 3;
thisEventItems.Add(eItem);
eItem = new SchedulerClasses.EventItem();
eItem.Id = 101;
eItem.Subject = "Class - Rugby @ Wanderers";
eItem.StartTime = new DateTime(2014, 5, 5, 16, 00, 00);
eItem.EndTime = new DateTime(2014, 5, 5, 17, 00, 00);
eItem.Description = "";
eItem.AllDay = false;
//eItem.Recurrence = false;
eItem.Recurrence = 0;
eItem.RecurrenceRule = "";
eItem.categoryId = "2";
eItem.groupId = 1;
eItem.ownerId = 3;
thisEventItems.Add(eItem);
return Json(thisEventItems, JsonRequestBehavior.AllowGet);
}
public class SchedulerClasses
{
public class EventItem
{
// NOTE: This class is structured to be the same as following local data
// window.EventsDataFamily = [
// {
// Id: 100,
// Subject: "Class",
// StartTime: new Date(2014, 4, 5, 9, 00),
// EndTime: new Date(2014, 4, 5, 16, 00),
// Description: "",
// AllDay: false,
// Recurrence: true,
// RecurrenceRule: "FREQ=DAILY;INTERVAL=1;COUNT=5",
// categoryId: "1",
// roomId: 1,
// ownerId: 3
// },
//
// I had originally set Recurrence to be Boolean since the recurrence value above was 'true'
// I have changed this to int (1=true, 0=false)
public int Id { get; set; }
public String Subject { get; set; }
public DateTime? StartTime { get; set; }
public DateTime? EndTime { get; set; }
public String Description { get; set; }
public Boolean AllDay { get; set; }
//public Boolean Recurrence { get; set; }
public int Recurrence { get; set; }
public String RecurrenceRule { get; set; }
public String categoryId { get; set; }
public int groupId { get; set; }
public int ownerId { get; set; }
}
}
Attachment:
Sample_1cbeeb79.zip