简体   繁体   English

fullcalendar 不会让我调整事件的大小(光标不显示,我做错了)

[英]fullcalendar won't let me resize an event (cursor doesn't show, i'm doing it wrong)

Hi stack trace bug chasers, I'm here to ask for help... I'm on symfony2, with twitter bootstrap and I'm desperately trying to enable resizing of my elements sent to the calendar through JSON by doing the following, I can drag the events, but not resize them... :嗨堆栈跟踪错误追逐者,我在这里寻求帮助......我在 symfony2 上,使用 twitter bootstrap,我正在拼命尝试通过执行以下操作来调整通过 JSON 发送到日历的元素的大小,我可以拖动事件,但不能调整它们的大小...:

Screenshot : http://nimga.fr/f/oDrdH.png截图: http : //nimga.fr/f/oDrdH.png

into the controller :进入控制器:

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)));

and in the view :并在视图中:

$('#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');

    }
})

I got jQuery and it's UI and droppable extensions loaded and still no arrow cursor to indicate that i can resize the event.我得到了 jQuery,它加载了 UI 和可放置的扩展,但仍然没有箭头光标指示我可以调整事件的大小。 Here is my head with the "dependencies"这是我的“依赖关系”

<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>

OK, I just found where the problem comes from : The "fullcalendar.print.css" overrides the basic "fullcalendar.css" and sets the resizing handle in "display: none" So with wiping the print css, it works.好的,我刚刚发现问题出在哪里:“fullcalendar.print.css”覆盖基本的“fullcalendar.css”并在“display:none”中设置调整大小的句柄,因此通过擦除打印css,它可以工作。 Thanks for reading.感谢阅读。

Only Long Event is re sizable.只有长事件是可调整的。 that event not have time along with the date.那个事件没有时间和日期。 Example:例子:

events: [
    {
        title: 'All Day Event',
        start: '2014-06-01'
    },
    {
        title: 'Long Event',
        start: '2014-06-07',
        end: '2014-06-10'
    },
    {
        id: 999,
        title: 'Repeating Event',
        start: '2014-06-09T16:00:00'
    },
    {
        id: 999,
        title: 'Repeating Event',
        start: '2014-06-16T16:00:00'
    },
    {
        title: 'Meeting',
        start: '2014-06-12T10:30:00',
        end: '2014-06-12T12:30:00'
    },
    {
        title: 'Lunch',
        start: '2014-06-12T12:00:00'
    },
    {
        title: 'Birthday Party',
        start: '2014-06-13T07:00:00'
    },
    {
        title: 'Click for Google',
        url: 'http://google.com/',
        start: '2014-06-28'
    }
]

Finaly i find the solution: Add allDay to each event!最后我找到了解决方案:将 allDay 添加到每个事件中!

var event = {
    start: startEvent,
    end: endEvent,
    title: "Test",
    allDay: true
}

You can add allDay : True to each event or just put allDayDefault={true} in calendar property.您可以将 allDay : True 添加到每个事件或仅将 allDayDefault={true} 放在日历属性中。 It will do the same.它会做同样的事情。

Hope it helps.希望它有帮助。

Add editable to the following code ( Working code on version 1.6.4 of fullcalendar, newer versions do not work) 可编辑内容添加到以下代码中(fullcalendar的1.6.4版本的工作代码,更新的版本不起作用)

var DATA = {
        "event_title": event.title,
        "event_id": event.id,
        "event_date": event.start,
        "dayDelta": dayDelta,
        "minuteDelta": minuteDelta,
        "allDay": allDay
        "editable":true     <<<<<<<<<--THIS
    };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM