嗨,堆栈跟踪bug追逐者,我在这里寻求帮助......我在symfony2上,使用twitter bootstrap,我拼命尝试通过JSON调整发送到日历的元素的大小,通过以下方式,我可以拖动事件,但不能调整它们的大小......:
截图:http://nimga.fr/f/oDrdH.png
进入控制器:
foreach($events as $event) {
$start = $event - > getDate();
$allDay = ($event - > getLength() >= 8);
$newevent = array('title' = > $event - > getTask() - > getName(),
'start' = > $start - > format('Y-m-d H:i:s'),
'id' = > $event - > getId(),
'allDay' = > $allDay,
'end' = > $start - > modify('+'.$event - > getLength().
' hour') - > format('Y-m-d H:i:s'));
$eventsArray[] = $newevent;
}
return $this - > render('IntranetTimesheetBundle:Task:displayall.html.twig', array('htmlTree' = > $htmlTree, 'eventlist' = > json_encode($eventsArray)));
并在视图中:
$('#calendar').fullCalendar({
droppable: true, // this allows things to be dropped onto the calendar !!!
weekends: false, // will hide Saturdays and Sundays
defaultView: 'agendaWeek',
slotMinutes: 60,
minTime: 7,
maxTime: 19,
events: {
{
eventlist | raw
}
},
editable: true,
resizable: true,
eventDrop: function (event, dayDelta, minuteDelta, allDay, revertFunc) {
var DATA = {
"event_title": event.title,
"event_id": event.id,
"event_date": event.start,
"dayDelta": dayDelta,
"minuteDelta": minuteDelta,
"allDay": allDay
};
$.ajax({
type: "POST",
url: "move",
data: DATA,
cache: false,
success: function (data) {
//to do in case of success
}
});
},
eventResizeStart: function (event, jsEvent, ui, view) {
console.log('RESIZE START ' + event.title);
},
eventResizeStop: function (event, jsEvent, ui, view) {
console.log('RESIZE STOP ' + event.title);
},
eventResize: function (event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view) {
console.log('RESIZE!! ' + event.title);
console.log(dayDelta + ' days'); //this will give the number of days you extended the event
console.log(minuteDelta + ' minutes');
}
})
我得到了jQuery,它的UI和droppable扩展加载,仍然没有箭头光标,以表明我可以调整事件。
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<link rel='stylesheet' type='text/css' href="http://arshaw.com/js/fullcalendar-1.6.4/fullcalendar/fullcalendar.css" />
<link rel='stylesheet' type='text/css' href="http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/1.6.4/fullcalendar.print.css" />
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/fullcalendar/1.6.4/fullcalendar.min.js"></script>
5条答案
按热度按时间frebpwbc1#
最后,我找到了解决方案:将allDay添加到每个事件!
mjqavswn2#
好吧,我刚刚发现问题出在哪里了:“fullcalendar.print.css”覆盖基本的“fullcalendar.css”,并在“display:没有”所以用css擦除打印,它起作用了。谢谢阅读。
e0uiprwp3#
只有长事件可调整大小。该事件没有时间沿着日期。示例:
czq61nw14#
您可以添加allDay:为每个事件设置True,或者在日历属性中设置allDayDefault={true}。它也会这样做。
希望能帮上忙。
5anewei65#
你可以使用方法。