简体   繁体   English

如何禁用全日历中具有特定日期的事件的需要?

[英]How can I disable the need for an event to have specific date in Fullcalendar?

I was going through Fullcanlendar's documentation to try to find a way to disable the need to enter a specific date from the calendar year to create an event. 我正在浏览Fullcanlendar的文档,以尝试找到一种方法来禁用从日历年中输入特定日期来创建事件的需要。 What I am looking for is a simple calendar option that only shows events on a weekly basis, and does not ask for a specific date such has November 25th. 我要寻找的是一个简单的日历选项,该选项仅显示每周一次的事件,而不要求特定的日期(例如11月25日)。 Basically, a calendar that works only in terms of Weekdays: Friday, thursday, etc. Is there an option for this? 基本上,日历仅适用于工作日:星期五,星期四等。是否有此选项?

example to call event on fullCalendar's event or click on date cell. 例如,在fullCalendar的事件上调用事件或单击日期单元格。

$(element).fullCalendar({
    dayClick: function(date, jsEvent, view) {
        var newDate = new Date(date.format());     
        return ((maxDate < newDate) ? '' : someFunctionCall(date.format('YYYY-MM-DD')));                
    },

    eventClick: function(calEvent, jsEvent, view) {                
       var date = calEvent.start.format('YYYY-MM-DD');
       someFunctionCall(date);                   
    }
});

dayClick is called when the user clicks on a day (calendar cell). 当用户单击一天(日历单元格)时,将调用dayClick。

eventClick is called when the user clicks an event. 用户单击事件时将调用eventClick。

calEvent is an Event Object that holds the event's information (date, title, etc). calEvent是一个事件对象,其中包含事件的信息(日期,标题等)。

jsEvent holds the native JavaScript event with low-level information such as click coordinates. jsEvent包含具有低级信息(例如单击坐标)的本机JavaScript事件。 Within the callback function, this is set to the event's <div> element. 在回调函数中,将其设置为事件的<div>元素。

date holds a moment object for the clicked day. date拥有点击日期的矩对象。

view holds the current View info like name, title etc.. 视图包含当前的视图信息,例如名称,标题等。

using these two event functions you can implement what you actually want to implement.. Hope this answer helped you. 使用这两个事件函数,您可以实现您实际想要实现的功能。希望此答案对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM