Fire fullcalender仅在双击时选择

时间:2016-09-20 06:43:21

标签: jquery jquery-ui fullcalendar fullcalendar-scheduler

我想只在双击时创建一个事件。以下是我尝试过的示例代码,

$('#calendar').fullCalendar({
    header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
    },
    defaultView: 'agendaDay',
    defaultDate: '2016-09-07',
    allDaySlot: false,
    slotEventOverlap: false,
    editable: true,
    selectable: true,
    select: function(start, end, jsEvent, view) {           
        alert('selected');
    },
    dayClick: function( date, jsEvent, view, resource ) {
        slotDate = date;   
    },
    eventLimit: true, // allow "more" link when too many events
    { id: 'a', title: 'Room A' },
            { id: 'b', title: 'Room B', eventColor: 'green' },
            { id: 'c', title: 'Room C', eventColor: 'orange' },
            { id: 'd', title: 'Room D', eventColor: 'red' }
        ],
        events: [
            { id: '1', resourceId: 'a', start: '2016-09-06', end: '2016-09-08', title: 'event 1' },
            { id: '2', resourceId: 'a', start: '2016-09-07T09:00:00', end: '2016-09-07T14:00:00', title: 'event 2' },
            { id: '3', resourceId: 'b', start: '2016-09-07T12:00:00', end: '2016-09-08T06:00:00', title: 'event 3' },
            { id: '4', resourceId: 'c', start: '2016-09-07T07:30:00', end: '2016-09-07T09:30:00', title: 'event 4' },
            { id: '5', resourceId: 'd', start: '2016-09-07T10:00:00', end: '2016-09-07T15:00:00', title: 'event 5' }
        ]
});
var slotDate; 
$("#calendar").dblclick(function() {            
    if(slotDate){           
        $('#calendar').fullCalendar( 'select', slotDate);
    }
});
$("#calendar").click(function(e) {
    e.preventDefault();
    e.stopPropagation();
});

我尝试从双击中激活选择。如何才能使完整日历选择事件仅在双击时触发?是否可以使用单击来实现其他功能?

0 个答案:

没有答案