douren7921
2016-02-27 23:07
浏览 171
已采纳

如何在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);
 }

图片转代码服务由CSDN问答提供 功能建议

我正在尝试在完整日历中有两种事件。

其中一个是可点击的,当我点击它们时打开一个弹出窗口。

如果点击它们,其他人就不会小心了 。

我正在使用 Fullcalendar Symfony https://github.com/adesigns/calendar-bundle

有人知道怎么做吗?

编辑:

在我的calendar-settings.js中:

  $('#calendar-holder')。  fullCalendar({
 
 
 select:function(start,end,jsEvent,view){
 alert(“test”); 
}),
 eventSources:[
 {
 url:Routing。  generate('fullcalendar_loader'),
类型:'POST',
 data:{},
 error:function(){},
},
 
] 
   \  n 
 

然后在我的CalendarEventListener中,我有:

  class CalendarEventListener {
 
 private $ entityManager; 
 
public function __construct(EntityManager $ entityManager){  
 $ this-> entityManager = $ entityManager  ; 
} 
公共函数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); 
} 
    
 
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongyong1400 2016-02-28 01:37
    已采纳

    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
    }
    
    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题