jqueryjquery-pluginsfullcalendar

Creating event id from database?


I'm populating the calendar with a json feed.

$return_arr = array();
$fetch = mysql_query("SELECT * FROM events"); 

while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
 $row_array['rowid'] = $row['id'];
     $row_array['title'] = $row['title'];
     $row_array['start'] = $row['start'];
     $row_array['end'] = $row['end'];

array_push($return_arr,$row_array);
      }

echo json_encode($return_arr);

And render the event:

calendar.fullCalendar('renderEvent',{
title: 'title',
start: start,
end: end,
allDay: allDay,
id: rowid
},
true // make the event "stick"          
);

When I use eventClick to get the id I get _fc1, _fc2 etc. Is there anyway I can get the id generated by my database? so I can refer to each individual event for updating?

Many thanks


Solution

  • You can simple add a custom field to your Event and then reference that in your click event.

    From the Docs

    Non-standard Fields

    In addition to the fields above, you may also include your own non-standard fields in each Event Object. FullCalendar will not modify or delete these fields. For example, developers often include a description field for use in callbacks such as eventRender.