How to get event by event id into fullcalendar?
16,206
Solution 1
According to the FullCalendar's documentation, you can achieve what you want by doing:
var evento = $("#calendar").fullCalendar('clientEvents', response.idEvent);
The brackets in the documentation mean that the parameter is optional.
Solution 2
If you want just get all properties of event you can add the [0] and choose properties through dot. For example you have event id as "_fc1" (got it from http://fullcalendar.io/js/fullcalendar-2.4.0/demos/agenda-views.html):
var eventoObj = $("#calendar").fullCalendar( 'clientEvents', "_fc1")[0];
var evento_allDay = eventoObj._allDay;
var evento_start = eventoObj._start;
var evento_end = eventoObj._end;
etc.
Related videos on Youtube
Author by
user3745888
Updated on June 04, 2022Comments
-
user3745888 almost 2 years
How is possible get and event by the event id of fullcalendar bootstrap?
I have the event id and I want get the event from this. I'm trying this:
var evento = $("#calendar").fullCalendar( 'clientEvents')[response.idEvent];
response.idEvent is the id event, this is correct (for example '32' from my mysql database), I know this because I print this and is correct, but I don't know how to get the event from this...
How can get this?
Thanks!
-
user3745888 over 8 yearsBut, if I print this or show with alert(evento), I get: "[object Object], [object Object]"... How can refresh this event if I get [object Object]?? Thanks!
-
user3745888 over 8 yearsI mean if I get "[object Object], [object Object]".. isn't the event, are some events. How can get the event if the id is unique??
-
Buzinas over 8 years@user3745888 That happens because it's a jQuery plugin, so it returns a jQuery object. You must use
evento[0]
to get the event itself. -
user3745888 over 8 yearsDo you know why I get undefined, if I add var evento = $("#calendar").fullCalendar('clientEvents', response.idEvent)[0]; ?? And I get the same ([object Object]..) if I write evento[0] ?