是否有可能仅通过单击用户获得所选事件而不是在fullcalendar
中填充的事件?我研究了文档,但在那里找不到太多帮助。
不过,我知道我可以通过:
获得所有活动$("#calendar").fullCalendar( 'clientEvents' [, idOrFilter ] ) -> Array
,但我不想要这个。我是使用select
。
其他著名的东西在这里我想要此值在另一个JS文件中。所以,
eventClick: function (selectedEvent) {
//selectedEvent.id
//selectedEvent.
}
实际上对我的情况不起作用。
以下是我的FullCalendar配置的样子:
$("#calendar").fullCalendar({
weekends: false,
defaultView: 'agendaWeek',
slotDuration: '00:30', // hours/minutes
allDaySlot: false,
header: {
left: 'today prev,next',
center: 'title',
right: ''
},
height: "auto",
contentHeight: 600,
events: [
{
title : 'event1',
start : '2017-05-01T12:30:00'
},
{
title : 'event2',
start : '2017-05-09T12:30:00',
end : '2010-05-09T13:30:00'
},
{
title : 'event3',
start : '2010-01-09T12:30:00',
allDay : false // will make the time show
}
],
businessHours: [ // specify an array instead
{
dow: [ 1, 2, 3 ], // Monday, Tuesday, Wednesday
start: '08:00', // 8am
end: '18:00' // 6pm
},
{
dow: [ 4, 5 ], // Thursday, Friday
start: '10:00', // 10am
end: '16:00' // 4pm
}
],
dayRender: function( date, cell ) {
alert('Clicked on: ' + date);
alert('Coordinates: ' + cell);
// alert('Current view: ' + view.name);
},
selectable: true,
selectConstraint: "businessHours",
select: function() { ... },
})
尝试使用EventClick:
eventClick: function (selectedEvent) {
//selectedEvent.id
//selectedEvent.title
}