我想禁用日点击事件



我想禁用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
  }
});

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

$("#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;
            },

返回 false,确实有效。 您是否刚刚尝试删除此块:

dayClick: function(seldate,jsEvent,view) {
                //window.location.href=entryScreen+"?dt="+seldate.format();
                return false;
            },
要确保的

一件事,对我来说它有所作为,是确保在每次更改后清除缓存。

只需删除dayClick功能块,如果返回false不起作用

相关内容

  • 没有找到相关文章