FullCalendar:如何停止拖动自定义事件? [英] FullCalendar: How to stop dragging custom events?

查看:1056
本文介绍了FullCalendar:如何停止拖动自定义事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我如何停止拖放/调整大小 event.id> 100

以代码示例更新:

 <$ c $ (event.id> 100){
event.disableDragging();
event.disableResizing();
}

element.qtip({
content:GetEventToolTip(event),
position:{corner:{tooltip:'bottomLeft',target:'topMiddle' }},
style:{
border:{
width:1,
radius:5
},
padding:5,
textAlign:'left',
tip:false,
name:event.iscustom =='True'?'cream':'dark'
}
});
}

谢谢。 b $ b

解决方案

功能都不是 disableDragging 也不是 disableResizing 从1.4.8开始在fullcalendar中定义。我敢肯定,世界上有两个人没有尝试过第一个建议:)不过,你需要使用jQuery UI对象来禁止在事件级别拖动或调整大小。因此(而不是尝试使用不存在的函数)在 eventRender(event,element)回调中尝试:

  if(event.id> 100){

element.draggable = false;




$ b $ p
$ b

请注意,我只是在jQuery元素上设置属性本身,因为它涉及到UI的可拖动行为。



除了需要删除div( class = ui-resizable (通过使用jquery选择器识别它并将其删除)(只需确保在yoru事件数组中为每个事件设置唯一的className,即可轻松识别它在 DOM 中)。请向Fullcalendar开发人员请求向Event对象添加 disableDragging disableResizing 属性。只需要不到一分钟的时间就可以向源代码添加支持。


Can anybody tell me how to stop dragging / resizing the events where event.id > 100? Only those events should be non draggable.

Updated with Code Sample:

eventRender: function(event, element) {
    if (event.id > 100) {
        event.disableDragging();
        event.disableResizing();
    }

    element.qtip({
        content: GetEventToolTip(event),
        position: { corner: { tooltip: 'bottomLeft', target: 'topMiddle'} },
        style: {
            border: {
                width: 1,
                radius: 5
            },
            padding: 5,
            textAlign: 'left',
            tip: false,
            name: event.iscustom == 'True' ? 'cream' : 'dark'
        }
    });
}

Thanks.

解决方案

Neither disableDragging nor disableResizing are functions defined in fullcalendar as of 1.4.8. I am certain that 2 people in the world haven't tried the first suggestion :) Nevertheless, you'll need to tap into the jQuery UI object itself to disable dragging or resizing at the event level. So (rather than trying to use non-existent functions) try this in your eventRender(event, element) callback:

if (event.id > 100) {

    element.draggable = false;

}

Note that I am simply setting the property on the jQuery element itself as it pertains to UI's draggable behavior.

The same goes for resizable EXCEPT that you will need to remove the div (class = ui-resizable-handle ui-resizable-s) that is appended by fullcalendar by identifying it with a jquery selector and removing it (just be sure to set a unique className per event in yoru events array so you can easily identify it in the DOM). Please kindly petition the fullcalendar developer(s) to add disableDragging and disableResizing properties to the Event object. It takes less than a minute to add support for this to the source.

这篇关于FullCalendar:如何停止拖动自定义事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆