Adding a property to eventObject in FullCalendar

I am using the json events property for FullCalendar to call a php script that returns a JSON string. The string has the required properties, plus some additional features, such as a description. The document says that you can add properties, but there is no information on how to do this.

I looked to see if it would be automatically added by looking at "event.description" (for example) in the eventRender callback. it was "undefined".

If anyone has experience with this, I would appreciate an example of how to do this.

David

+3
source share
1 answer

FullCalendar, . FullCalendar , script, .

, :

var event = {
 id          : '123',
 title       : 'New Event',
 url         : 'http://thearena.com/',
 start       : "Sun, 18 Jul 2010 13:00:00 EST",
 end         : "Sun, 18 Jul 2010 17:00:00 EST",
 allDay      : false,

 location    : 'The Arena',
 description : 'Big Event',

 editable    : true
};
$('.fc').fullCalendar( 'renderEvent', event, true ) // Add Event to fullCalendar

// Add script here to post the event back to your server

, script . , ( - ). URL- , /.

$('.fc').fullCalendar({
 eventClick: function(calEvent, jsEvent, view) {
  var event = 'Event: ' + calEvent.title + '<br>' +
   'Location: ' + calEvent.location + '<br>' + 
   'Start time: ' + calEvent.start + '<br>' +
   'End time: ' + calEvent.end + '<br>' +
   'Description: ' + calEvent.description;

  alert(event);
  // jQuery.facebox(event); // this would open the HTML in a facebox popup window

  if (calEvent.url) {
    window.open(calEvent.url);
    return false;
  }
});
+4

Source: https://habr.com/ru/post/1755169/


All Articles