anubis
anubis

Reputation: 1505

How can I have different type of events in Fullcalendar?

I'm trying to have two sort of events in full calendar.

One of them is clickable and open a popup when I click on them.

The others one don't take care if I click on them.

I'm using Fullcalendar with Symfony : https://github.com/adesigns/calendar-bundle

Anybody know how to do that?

EDIT:

In my calendar-settings.js:

$('#calendar-holder').fullCalendar({


    select: function (start, end, jsEvent, view) {
        alert("test");
    }),
    eventSources: [
        {
          url: Routing.generate('fullcalendar_loader'),
          type: 'POST',
          data: {},
          error: function () {},
       },
    ]

Then in my CalendarEventListener I have:

class CalendarEventListener {

    private $entityManager;

public function __construct(EntityManager $entityManager) {
    $this->entityManager = $entityManager;
}
 public function loadEvents(CalendarEvent $calendarEvent) {      
    $eventEntity = new EventEntity('firstEvent', new DateTime(), new DateTime());
    $calendarEvent->addEvent($eventEntity);
    $eventEntity = new EventEntity('secondEvent', new DateTime(), new DateTime());
    $calendarEvent->addEvent($eventEntity);
 }

Upvotes: 0

Views: 706

Answers (1)

smcd
smcd

Reputation: 3265

One way may be to have a property 'clickable' or something in the event object set to true/false, and then upon eventClick only proceed where it is clickable = true?

eventClick: function (event, jsEvent, view) {
    if (event.clickable === false) { return; }
    // Else, carry on
}

Upvotes: 1

Related Questions