2016-02-27 23 views
0

我想在完整的日曆中有兩種事件。如何在Fullcalendar中使用不同類型的事件?

其中之一是可點擊的,當我點擊它們時打開一個彈出窗口。

其他人不關心,如果我點擊它們。

我使用FullcalendarSymfonyhttps://github.com/adesigns/calendar-bundle

任何人都知道該怎麼做?

編輯:

在我的日曆settings.js:

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


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

然後在我的CalendarEventListener我:

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); 
} 
+0

我編輯我的職務,我用fullcalendars捆綁在symfony:https://github.com/adesigns/calendar-bundle – anubis

+0

請出示您的事件處理代碼中的插件選項對象。還有事件對象要知道有什麼區別 – charlietfl

回答

1

的一種方式可能是有一個屬性 '點擊'或事件對象中的某些設置爲true/false,然後在eventClick僅在可點擊= true的情況下繼續?

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

哦,是的,所以我可以做我想做的和更多! Thanls! – anubis

相關問題