Javascript – ID of an event (Fullcalendar)

fullcalendarjavascriptMySQL

I need add an id to every single event from Fullcalendar, I found this http://arshaw.com/fullcalendar/docs/event_data/Event_Object/ but I don't know how, this id is
unique for every single event, because then I save the events in a Mysql database. Thanks

Best Answer

I found the solution! When you create any event, put your uniqe id here :

var shift = calendar.fullCalendar('renderEvent',
        {
            id: shift_id,
            title: current_name,
            start: new Date(y, m, d + current_day, current_start_time_h, current_start_time_m),
            end: new Date(y, m, d + current_day, current_end_time_h, current_end_time_m),
            allDay: false
        }, true // make the event "stick"
        );

After that this listener append ID in DOM structure:

     eventAfterRender:function( event, element, view ) { 
$(element).attr("id","event_id_"+event._id);
},

To get all your events on a field:

console.log(calendar.fullCalendar('clientEvents'));

Now you have array of events, and all event are numbered in DOM structure!