我想禁用dayclick事件

时间:2019-04-15 10:57:36

标签: jquery fullcalendar fullcalendar-scheduler

我想禁用dayClick事件。 select事件始终在dayClick事件之后触发。我想阻止它。 我可以禁用dayClick事件吗?

$(function() {
$('#calendar').fullCalendar
({
  defaultView: 'agendaDay',
  defaultDate: '2018-04-07',
  editable: true,
  selectable: true,
  eventLimit: true, // allow "more" link when too many events
  header: {
    left: 'prev,next today',
    center: 'title',
    right: 'agendaDay,agendaTwoDay,agendaWeek,month'
  },
  views: {
    agendaTwoDay: {
      type: 'agenda',
      duration: { days: 2 },
      groupByResource: true
    }
  },

  resources: [
    { id: 'a', title: 'Room A' },
    { id: 'b', title: 'Room B', eventColor: 'green' },
    { id: 'c', title: 'Room C', eventColor: 'orange' },
  ],
  events: [
    { id: '1', resourceId: 'a', start: '2018-04-06', end: '2018-04-08', title: 'event 1' },
  ],

  select: function(start, end, jsEvent, view, resource) {
    alert("select");
  },

  dayClick: function(date, jsEvent, view, resource) {
    alert("dayClick");
    return false;//not work
    //jsEvent.preventDefault();//not work
    //$('#calendar').fullCalendar('unselect');//not work
  }
});

2 个答案:

答案 0 :(得分:0)

这是我的代码的一部分,并且确实禁用了每日点击

template <class T>
void LinkedList<T>::RemoveFromEnd() {
  node<T>* cur = head;
  node<T>* pre = cur;

  while(cur->next != NULL) {
    pre = cur;
    cur = cur->next;
  }

  pre->next = NULL;
  tail = pre;
  size--;
}

返回假,可以正常工作。您是否刚刚尝试删除此阻止:

$("#datepicker").fullCalendar({
            header: {
                left:   'cbRefresh,prevYear,prev,next,nextYear,cbMonth',
                center: 'title',
                right:  '' //month,basicWeek,listWeek
            },
            height:             750,
            firstDay:           1,
            weekNumbers:        true,
            editable:           true,
            eventLimit:         true,
            defaultView:        'month',
            displayEventTime:   false,
            weekends:           uweekends,
            views:  {
                month:  {
                    eventLimit: 3
                }
            },
            dayClick: function(seldate,jsEvent,view) {
                //window.location.href=entryScreen+"?dt="+seldate.format();
                return false;
            },

要确保对我有所帮助的一件事是,确保每次更改后清除缓存。

答案 1 :(得分:0)

如果返回false无效,只需删除dayClick功能块