Javascript 在FullCalendar中拖放外部元素-使用资源日视图
在我的项目中,我使用Sean Kenny的fullCalendar插件。我使用的是defaultView:“resourceDay”。我想将外部元素拖放到日历中。它与其他视图(如defaultView:“agendaDay”)配合良好,但与defaultView:“resourceDay”配合不好。是否可以使用resourceDay视图将外部元素拖放到日历中 下面是我试过的样本Javascript 在FullCalendar中拖放外部元素-使用资源日视图,javascript,jquery,fullcalendar,Javascript,Jquery,Fullcalendar,在我的项目中,我使用Sean Kenny的fullCalendar插件。我使用的是defaultView:“resourceDay”。我想将外部元素拖放到日历中。它与其他视图(如defaultView:“agendaDay”)配合良好,但与defaultView:“resourceDay”配合不好。是否可以使用resourceDay视图将外部元素拖放到日历中 下面是我试过的样本 $('#calendar').fullCalendar({ header: {
$('#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) {
}
});
请帮帮我。
谢谢事实上,是我们要求您分享您尝试过的示例代码…而不是其他方式。这对我来说是有帮助的you@Console.log我也尝试了eventDrop属性。但它不起作用。当我拖放日历中已经存在的事件时,会触发eventDrop属性,但在将外部元素拖放到日历中时不会触发calendar@JohncyBinoy,您解决了这个问题吗?在我的例子中,外部事件会放到日历中(我正试图放到资源视图中),但它不会显示在那里(刚刚消失),但当我更改月视图和周视图时,显示的是相同的外部删除事件!!!因此我不知道如何在ResourceView上显示相同的事件。当删除的事件不坚持ResrouceView时,甚至我也已将resourceId与事件一起设置。