2013-12-17 50 views
0

我爲我的事件源使用帶有2個JSON訂閱源的fullCalendar。我使用eventClick在單擊事件時打開模式窗口。不過,我只需要第一個事件源的模式窗口(json-events.php)。我想從第二個來源(json-paidstaff.php)的所有事件只是沒有eventClick函數的靜態框。有沒有什麼辦法只爲一個來源指定eventClick?目前fullCalendar動態事件點擊行爲

$('#calendar').fullCalendar({ 

editable: false, 
timeFormat: 'H(:mm)', // uppercase H for 24-hour clock 
eventSources: [ 
    // your event source 
    { 
     url: 'json-events.php?uid=$bbuserinfo[userid]' 
    }, 

    // any other sources... 
    { 
     url: 'json-paidstaff.php?uid=$bbuserinfo[userid]', 
     color: 'black', // a non-ajax option 
     textColor: 'white' // a non-ajax option 
    } 

], 

eventRender: function (event, element) { 
    element.find('.fc-event-title').append("<br/>" + event.namescreds); 
}, 

loading: function (bool) { 
    if (bool) $.blockUI(); 
    else $.unblockUI(); 
}, 

eventClick: function (calEvent, jsEvent, view) { 
    $.blockUI(); 
    Boxy.load('ajax.php?uid=$bbuserinfo[userid]&id=' + calEvent.id, { 
     modal: true, 
     closeable: true, 
     afterShow: ($.unblockUI()) 
    }); 
    } 
}); 

回答

1

正如你可以有自己的非標準的領域,在這裏我們可以任意的信息,在我們的例子中,我們可以存儲該事件屬於文檔中給出

我的JS。

$('#calendar').fullCalendar({ 
    header: { 
     left: 'prev,next today', 
     center: 'title', 
     right: 'month,agendaWeek,agendaDay' 
    }, 
    editable: true, 
    events: [{ 
     "id": 1, 
      "title": "Hello World", 
      "start": "Wed, 15 Jan 2014 09:00:00", 
      "end": "Wed, 15 Jan 2014 10:00:00", 
     "belongsto" : "list 1" 

    }, { 
     "id": 2, 
      "title": "Good Afternoon", 
      "start": "Wed, 23 Jan 2014 13:00:00", 
      "end": "Wed, 23 Jan 2014 17:00:00", 
     "belongsto" : "list 2" 
    }], 
    eventClick: function(calEvent, jsEvent, view) { 
     alert(calEvent.belongsto); 
     if(calEvent.belongsto === "list 1") { 
       //do something. 
     } 
    } 
}); 

DEMO