FullCalendar - 如何为每个eventSource提供不同的clickEvent

时间:2013-05-07 15:50:19

标签: fullcalendar

我正在寻找一种方法来根据eventSource使用不同的eventClick,并且有一些没有eventClick的eventSource。这样我可以根据它的来源打开一个不同的弹出事件。

我从这个例子开始:

$(document).ready(function() {

        $('#calendar').fullCalendar({
                height: 600,
                theme: true,
                eventSources: [
                    {
                    url: 'http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic',
                    className: 'fc-event-title-event'                   
                    } ,
                    {
                    url: 'testCalendar',
                    color: 'red',
                    currentTimezone: 'America/New_York',
                    editable: true                   
                    } 

            ],

            eventClick: function(calEvent, jsEvent, view ) {                        
                        alert('Event: ' + calEvent.title);
                        alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
                        alert('View: ' + view.name);

                        //window.open(event.url, 'gcalevent', 'width=700,height=600');
                        return false;
                    },      

            loading: function(bool) {
                if (bool) {
                    $('#loading').show();
                }else{
                    $('#loading').hide();
                }
            }           
        });     
    });

两个来源都会触发eventClick。似乎有一种方法可以自定义每个源的eventClick,但我没有在文档中看到它,也没有在stackoverflow和google中进行无数次搜索。

提前谢谢。

1 个答案:

答案 0 :(得分:1)

嗯,我认为eventSources没有eventClick的选项。您可以使用calEvent对象并检查它source以确定如何处理click事件。除此之外,我不认为fullcalendar具有您正在寻找的内置功能。<​​/ p>

希望这有帮助。

相关问题