jquery - how to update an event in fullCalendar? -
i want update json in fullcalendar, here trying do. have json string directly trying feed in event objects in full calendar.
-->
var json[ { "id": "1", // optional "title": "demo event", // required "start": "2013-08-28 10:20:00", // required "end": "2013-08-28 11:00:00", // optional "allday": false, // optional "url": "http://google.com", // optional, not open because of browser-iframe security issues "classname": "test-class", // optional "editable": true, // optional "color": "yellow", // optional "bordercolor": "red", // optional "backgroundcolor": "yellow", // optional "textcolor": "green" // optional }, { "id": "2", // optional "title": "demo event 2", // required "start": "2013-08-27 10:20:00", // required "end": "2013-08-27 11:00:00", // optional "allday": false, // optional "url": "http://google.com", // optional, not open because of browser-iframe security issues "classname": "test-class", // optional "editable": true, // optional "color": "yellow", // optional "bordercolor": "red", // optional "backgroundcolor": "yellow", // optional "textcolor": "green" // optional } ];
,
then want modify json on drop down event (not shown in fiddle) new string , try new event on calendar.
the fullcalendar not take effect.
http://jsfiddle.net/pratik24/u8ksw/28/
thanks help. appreciate it.
you aren't calling correct fullcalendar method render new events.
this not work because meant render events first time around:
$("#demo-calendar").fullcalendar('renderevents', json);
instead need remove events on calendar , refresh them:
$("#demo-calendar").fullcalendar('removeevents'); $("#demo-calendar").fullcalendar('addeventsource', json);
check fiddle: http://jsfiddle.net/shaunp/u8ksw/29/
note there fullcalendar method called refetchevents
, not work on array of events such have created, must manually take events off , re-add event source again.
Comments
Post a Comment