Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get event by event id into fullcalendar?

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!

like image 369
user3745888 Avatar asked Sep 22 '15 14:09

user3745888


People also ask

How do I get events on FullCalendar?

Calendar::getEvents Retrieves events that FullCalendar has in memory. This method will return an array of Event Objects that FullCalendar has stored in client-side memory.

How do I add a resource to FullCalendar?

fullCalendar('addResource', { id: 'e', title: 'Room E' }); If you would like the new resource to be a child of an existing resource, make sure to set its parentId . If the scroll argument is true , the current view will scroll to the newly added resource to ensure it is visible.

How do I create a dynamic event in FullCalendar?

although it is not specified on the fullcalender site, it is necessary to assign a value to the "allday" parameter to be able to add new events dynamically. If you set this value to "false", it will not add the event to the AllDay row. If you do "true" it will add to the AllDay row. Save this answer.


2 Answers

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.

like image 67
Buzinas Avatar answered Sep 21 '22 10:09

Buzinas


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.

like image 45
Ruslan Korkin Avatar answered Sep 18 '22 10:09

Ruslan Korkin