2009-11-09 73 views
6

我有一個功能fullCalendar http://arshaw.com/fullcalendar/工作檢索從谷歌日曆單一來源的事件,像這樣:如何在jQuery插件fullCalendar中使用多個源代碼?

$('#calendar').fullCalendar({ 

    events: $.fullCalendar.gcalFeed(
     "http://www.google.com/calendar/feeds/etc", // feed URL 
     { className: 'gcal-events' }     // optional options 
    ) 

    }); 

我的挑戰,然而,有多個飼料在未來的fullCalendar文件說:

eventSources:數組 的「事件」選項類似,除了一個可以指定多個來源。例如,可以指定一個JSON URL數組,一組自定義函數,一組硬編碼事件數組或任意組合。

但沒有例子,所以這裏這個JSON新手有點卡住了。

什麼那就需要使用eventSources任何想法和飼料的陣列?

+0

要做到這一點同樣的事情。我會一直捅它看看我怎麼走。 – Tyronomo 2009-11-23 06:23:04

+0

cosmicbdog(或一個mod-powered傢伙)你可以請添加標籤'fullcalendar'。在評論中查看我的答案中的請求。 乾杯。 – Tyronomo 2009-12-10 22:59:48

回答

9
這裏

實測溶液; http://code.google.com/p/fullcalendar/issues/detail?id=192&q=eventSources

eventSources: 
[ 
    'msCal.txt', // location of Cal JSON script 
    'msLogBook.txt', // location of LogBook JSON object 
    'msEvents.txt' //location of the Events JSON object 
] 

在事後痛苦地簡單。以下是我的測試頁面;

eventSources: 
[ 
    $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/en.australian%23holiday%40group.v.calendar.google.com/public/basic'), 
    $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic'), 
    $.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/en.indonesian%23holiday%40group.v.calendar.google.com/public/basic') 
], 
+0

天才在它的簡單:) Tyronomo – willdanceforfun 2009-12-01 03:45:20

+1

Tyronomo,很高興你有TX這個工作。我是FullCalendar的創建者,我想開始跟蹤StackOverflow上所有與FullCalendar相關的問題。你會如此編輯這篇文章,並添加標籤「fullcalendar」?我鑼開始監測這個標籤,這將是一個很好的幫助。謝謝! – arshaw 2009-12-09 04:34:22

+0

arshaw,我會加入對請求cosmicbdog更新的問題的類似評論。沒有標籤的答案。 :( – Tyronomo 2009-12-10 22:57:53

1

我有同樣的問題,上面的想法對我稍作修改。我需要它在頁面上顯示5個日曆,但在另一個頁面上只顯示1個日曆,所以我這樣做了。

<?php if (is_page("calendar")):?> 
events:'...google calendar url #1...', 
<?php endif; ?> 

<?php if (is_page("meeting-schedule")):?> 
    eventSources: [ 
    $.fullCalendar.gcalFeed('...google calendar url #1...'), 
    $.fullCalendar.gcalFeed('...google calendar url #2...'), 
    $.fullCalendar.gcalFeed('...google calendar url #3...'), 
    $.fullCalendar.gcalFeed('...google calendar url #4...'), 
    $.fullCalendar.gcalFeed('...google calendar url #5...') 
    ], 
<?php endif; ?> 

完美的作品!

相關問題