| Issue 129: | fetching events using function | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Hi,
I've tried this to get it
...
events: function() {
var calevents = new Array();
calevents[0] = new Array( "id: 3",
"title: \"Event3\"",
"start: 2009-10-10T13:00:00Z",
"allDay: true");
return calevents;
},
...
This should do the same like the following hardcoded version:
...
var d = new Date();
var y = d.getFullYear();
var m = d.getMonth();
events: [
{
id: 3,
title: "Event3",
start: new Date(y, m, 14),
allDay: true
}
],
...
But it doesn't work. I've had look about the general form in the
documentation
events: function(start, end, callback) {
// do some asynchronous ajax
$.getJSON("/myscript",
{
start: start.getTime(),
end: end.getTime()
},
function(result) {
// format the result into an array of CalEvents
// (not seen here)
// then, pass the CalEvent array to the callback
callback(calevents);
});
}
Any suggestions?
With best regards
Chris
Aug 4, 2010
Hi Christia, Have you tried with callback function. I have tried but it is not working. Could you please help me. Thanks prasad
Aug 4, 2010
Hi,
no I didn't do that with a callback. Just made an array with my data and passed it to the events param.
var calevents_array = new Array();
$(mResultXML).find("z\\:row").each(function() {
var list_year = $(this).attr("ows_Date").substr(0, 4);
var list_month = $(this).attr("ows_Date").substr(5, 2) - 1;
var list_date = $(this).attr("ows_Date").substr(8, 2);
...
calevents_array.push({ className: classname, name: list_author,...
...
Events: calevents_array
With best regards
Chris
Aug 4, 2010
Hi, Thanks for you help. In my senario i don't have any backend XML file.I am getting values in runtime from table that i need to show in the calendar. Please help me how to do. Thanks prasad |
|
| ► Sign in to add a comment |
you need to call the "callback" so the whole process can be asynchronous. you don't 'return' the value. here is what you should do: events: function(start, end, callback) { var calevents = new Array(); ... callback(calevents); } hope this helps ~adam