limit selectable to a single day

By default if you enable the 'selectable' attribute it will allow you to click and drag and select several days. I would like to only allow the user to select a single day, not drag over multiple. Is there a way to have 'selectable' enabled, but disable the dragging feature that comes along with it?


If you want to limit highlight to a single day in agenda week view you can use following:

  selectConstraint:{
      start: '00:01', 
      end: '23:59', 
    },

if you want to limit the event you can use

eventConstraint:{
      start: '00:00', 
      end: '24:00', 
    },

in the select callback, adding the following does the trick: (fullcalendar 2 using moment.js)

if (start.add('days', 1).date() != end.date() )
  $scope.eventCal.fullCalendar('unselect');

resources:

http://arshaw.com/fullcalendar/docs/selection/select_callback/ http://arshaw.com/fullcalendar/docs/selection/unselect_method/


You can select a single date or time by passing fullcalendar's 'select' method to the dayClick event listener:

$('#myCalendar').fullcalendar({
    dayClick: function(date,jsEvent,view) {
        $('#myCalendar').fullcalendar('select', date);
    }
});

Note you will also need to fire the 'unselect' method on your next callback (or dayClick).

链接地址: http://www.djcxy.com/p/81174.html

上一篇: 全日历月视图中的单日活动

下一篇: 限制可选择一天