簡體   English   中英

全日歷重復事件排除

[英]Fullcalendar recurring event exclusion

我正在將fullcalendar與拖放外部事件和json數據源一起使用。 默認情況下,這些事件每周重復一次。

我現在想添加功能,使用戶可以刪除此重復事件的單個實例(例如在Google日歷中)。 我相信這將需要某種機制來從重復事件中排除某個事件日期。

我無法在完整日歷文檔中找到任何可以支持這種行為的現成方法。

我希望有一個僅客戶端解決方案。

我創建了一個jsfiddle ,它顯示了如何顯示除一個日期之外的每日並發事件。 我包括一個自定義屬性(excludedDate)。 在您的解決方案中,您將需要包括一個名為excludedDates的屬性,該屬性包含一個日期數組,並且每次您要刪除單個實例時,只需將日期添加到此屬性數組中即可。 然后,在eventRender上,您將遍歷此數組以查看是否需要在任何給定日期排除事件。

eventRender: function(event, element, view) {

    var theDate = event.start
    var excludedDate = event.excludedDate;
    var excludedTomorrrow = new Date(excludedDate);
     //if the date is in between August 29th at 00:00 and August 30th at 00:00 DO NOT RENDER
    if( theDate >= excludedDate && theDate < excludedTomorrrow.setDate(excludedTomorrrow.getDate() + 1) ) {
        return false;
    }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM