I am having trouble loading scheduler events in .NET MVC 4, I am returning json object from the server but it is not loading the events, here is code snippet
var event = {
id: '',
start_date: '',
end_date: '',
text: '',
details: ''
};
var model = { event: [] };
$.ajax({
type: "POST",
url: ['@Url.Action](mailto:'@Url.Action)("CalendarEvents")', // add Mobile directory on Dev and Prod
dataType: "json",
data: (model),
error: function (xhr) {
//alert(xhr.responseText);
alert("Critical Error!. Failed to call the server.");
},
success: function (data, jqXHR) {
// There is no problem with the validation
if (data.noResult) {
alert("no events loaded");
return;
}
else {
//data is not valid display error message
model = data.events;
$$("scheduler").parse(model, "json");
}
}
});
Also, I tried another way to load from the server using dhtmlx.dll helper
scheduler.EnableDataprocessor = true;
scheduler.config.serverLists = {};
$$(“scheduler”).load("/calendar/Data", “json”);
where Data function in the controller is
Public Function Data() As ContentResult
Dim data__1 = New SchedulerAjaxData(New List(Of CalendarEvent)() From { _
New CalendarEvent() With { _
.id = 1, _
.start_date = New DateTime(2011, 9, 3, 6, 0, 0), _
.end_date = New DateTime(2011, 9, 3, 8, 0, 0), _
.text = "Sample Event" _
}, _
New CalendarEvent() With { _
.id = 2, _
.start_date = New DateTime(2011, 9, 5, 9, 0, 0), _
.end_date = New DateTime(2011, 9, 5, 12, 0, 0), _
.text = "New Event" _
}, _
New CalendarEvent() With { _
.id = 3, _
.text = "Multiday Event", _
.start_date = New DateTime(2012, 9, 3, 10, 0, 0), _
.end_date = New DateTime(2012, 9, 10, 12, 0, 0) _
} _
})
Return data__1
' Return _data
End Function
please advise me on how to get these events loaded, I need to get this working before I decide on buying the full license.
Thanks