Closed jaseemabid closed 11 years ago
@Serhioromano I should be able to just give it an array of events from a local variable than make a ajax call. What if i already have the events on the page?
This is 1. I asked about 2.
There should be no reason to tweak an existing API server just to make it work with this plugin. If your plugin needs a property called title
, and if the server provides eventTitle
, there should be a parse function to tweak the response object, fix the structure and names etc. Refer backbone doc for more info.
May be you try to make a code example?
Refer backbone doc for more info.
We do not use backbone.
You don't have to use backbone, they documented the need for a parse function properly. Say the plugin needs a title
and server gives eventTitle
in the array of events, you need a function like this
function(response) {
response.forEach(function(event) {
event.title = event.eventTitle;
delete event.eventTitle;
});
return response;
}
If plugin needs a array of events and the server is sending it in another top level json like this,
{
events: [the array you want]
}
you can deal that with a parse function like this
function(response) {
return response.events;
}
We have onAfterEventsLoad
callback.
var calendar = $('#calendar').calendar({
onAfterEventsLoad: function(events) {
$.each(events, function(key, val) {
val.title = val.eventTitle;
delete val.eventTitle;
}
}
});
@Serhioromano Hi any update on loading events from a local variable...??
@Ashwin2488 no :)
I'm going to implement this
Now Bootstrap Calendar accepts the events_source
option: it can be an URL (same as previous events_url
option), or it can be a function. That function can do what you want, including events taken from a local variable.