简体   繁体   English

事件的完整日历拖动手柄

[英]Full Calendar drag handle for events

I am looking for a way to implement a jquery ui like drag handle on individual events inside of a full calendar. 我正在寻找一种方法来实现像完整的日历内的单个事件上的拖动句柄的jQuery用户界面。

the use case being 用例是

$("#calendar").fullCalendar({
    //the normal parameters here
    eventsDragHandle: "someClass"
});

or 要么

$("#calendar").fullCalendar({
   //the normal parameters here
   eventHasDragHandle: true
});

This way the event won't drag unless if the specific handle is moused down on. 这样,除非将特定的句柄按下,否则事件不会拖动。

I have attempted to modify the fullcalendar.js to no avail and only crashing the javascript code. 我试图将fullcalendar.js修改为无济于事,只崩溃了javascript代码。

Thanks, Kevin 谢谢,凯文

I have seem to find a way to get this to work. 我似乎已经找到一种方法来使其工作。

When instantiating your fullCalendar in the eventRender tag add your html that is going to be the drag handle of the event element. 在eventRender标记中实例化fullCalendar时,添加将成为event元素的拖动句柄的html。

eventRender: function(event, element, view)
{
    var theHtml = "<div class='stops'>X</div>";
    $(element).append(theHtml);
}

In the full calendar source, find the function draggable*Event where * is the type of calendar event you want to have a drag handle on. 在完整的日历源中,找到函数draggable * Event,其中*是您要对其进行拖动处理的日历事件的类型。 (such as the draggableDayEvent) (例如draggableDayEvent)

in the code for binding draggable add the appropriate 'handle' tag 在绑定可拖动代码中,添加适当的“ handle”标签

eventElement.draggable({
   handle: ".stops",
   //etc...
});

The reason this works is because the eventRender happens before the element is drawn and draggable is associated, so the html for the handle get appended before the draggable event is bound. 之所以起作用,是因为eventRender发生在绘制元素和可拖动对象关联之前,因此在绑定可拖动事件之前附加了句柄的html。

I hard code modified it with the class ".stops" for my uses, but this could easily be turned into another option parameter for all of full calendar. 我使用“ .stops”类对其进行了硬编码修改,但可以很容易地将其转换为整个日历的另一个选项参数。

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

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