在FullCalendar中拖放外部元素 - 使用资源日视图

时间:2016-08-31 05:32:52

标签: javascript jquery fullcalendar

在我的项目中,我正在使用Sean Kenny的fullCalendar插件https://github.com/seankenny/fullcalendar/blob/v2/dist/fullcalendar.js。我使用的是defaultView:' resourceDay'。我想将外部元素拖放到日历中。它可以与其他视图一起使用,例如defaultView:' agendaDay',但不适用于defaultView:' resourceDay'。是否可以使用resourceDay视图将外部元素拖放到日历中?

以下是我试过的样本,

     $('#calendar').fullCalendar({
         header: {
             left: 'prev,next today',
             center: 'title',
             right: 'month,agendaWeek,resourceDay'
         },             
         defaultView: 'resourceDay',                      
         defaultDate: $.fullCalendar.moment( new Date(sessionStorage.sDate) ),              
         editable: true,
         droppable: true,            
         minTime: '07:00:00', 
         maxTime: '22:00:00',
         slotDuration: '00:05:00',
         axisFormat: 'h(:mm) A',               
         nowIndicator: true,
         resources: [{"id":"xxxxxxxxxxxx7PzAAI","name":"some name"},{"id":"xxxxxxxxxxxx7PzAAP","name":"some name"},{"id":"xxxxxxxxxxxx7PzABP","name":"some name"},{"id":"xxxxxxxxxxxx7PzABA","name":"some name"}],
         events:[{
         appointmentId: "xxxxxxxxx",
         appointmentTreatmentId: "xxxxxxxxxxxxxxxxx",
         className: "scheduled",
         doctorName: "some name",
         employee: "xx-xxxx",
         employeeId: "xxxxxxxxxxx",             
         isNew: false,
         location: "xxxxxxxxxx",
         mobile: "(xxx) xxx-xxxx",
         notes: "sample notes",
         orderId: "xxxxxxxxxx",
         patient: "some patient",
         patientId: "xxxxxxxxxxx",
         resources: "xxxxxxxxxxxx7PzAAI",            
         },
         {
         appointmentId: "xxxxxxxxx",
         appointmentTreatmentId: "xxxxxxxxxxxxxxxx",
         className: "scheduled",
         doctorName: "some name",
         employee: "xx-xxxx",
         employeeId: "xxxxxxxxxxx",             
         isNew: false,
         location: "xxxxxxxxxx",
         mobile: "(xxx) xxx-xxxx",
         notes: "sample notes",
         orderId: "xxxxxxxxxx",
         patient: "some patient",
         patientId: "xxxxxxxxxxx",
         resources: "xxxxxxxxxxxx7PzAAP"             
         },
         {
         appointmentId: "xxxxxxxxx",
         appointmentTreatmentId: "xxxxxxxx9AAA",
         className: "scheduled",
         doctorName: "some name",
         employee: "xx-xxxx",
         employeeId: "xxxxxxxxxxx"
         isNew: false,
         location: "xxxxxxxxxx",
         mobile: "(xxx) xxx-xxxx",
         notes: "sample notes",
         orderId: "xxxxxxxxxx",
         patient: "some patient",
         patientId: "xxxxxxxxxxx",
         resources: "xxxxxxxxxxxx7PzABP"
         },
         {
         appointmentId: "xxxxxxxxx",
         appointmentTreatmentId: "xxxxxxxxxxxx",
         className: "scheduled",
         doctorName: "some name",
         employee: "xx-xxxx",
         employeeId: "xxxxxxxxxxx"
         isNew: false,
         location: "xxxxxxxxxx",
         mobile: "(xxx) xxx-xxxx",
         notes: "sample notes",
         orderId: "xxxxxxxxxx",
         patient: "some patient",
         patientId: "xxxxxxxxxxx",
         resources: "xxxxxxxxxxxx7PzABA"
         }
         ], 
         viewDisplay: function(view) {   
             window.clearInterval(timelineInterval);
             timelineInterval = window.setInterval(setTimeline, 10000);

         },                    
         selectable: {
             month: false,
             default: true
         },              
         select: function(start, end, ev) {
             setTheDocValue(ev.data.id, (start).format('YYYY-MM-DD HH:mm:ss'), (end).format('YYYY-MM-DD HH:mm:ss'), '', '');
         },

         drop: function(date, ev) {                    
                 var oEventObject = $(this).data('event');
                 var cEventObject = $.extend({}, oEventObject);                    
                 cEventObject.start = date;                     
                 $('#calendar').fullCalendar('renderEvent', cEventObject, true);

         }, 
        eventDrop: function(event, delta, revertFunc, jsEvent, ui) { 

         }                       
     });

请帮帮我。 感谢

0 个答案:

没有答案