- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试创建一个基于 AngularJS 的花名册。对于这个项目,我使用的是 fullcalendar(调度程序版本)。
这是我目前的状态:
我的目标是,我想将我的员工拖放到工作层中。例如,我的工作层内的“Haris Bjelic”(显示为“WL from 01.06 - 04.06”)。
然后我知道“Haris Bjelic”需要从 01.06 工作到 04.06(没有任何休息,呵呵)。首先,我试图找到一个函数,使我有可能在另一个事件中添加一个事件。在这种情况下,我首先创建了一个名为“01.06 的工作层”的层。 - 04.06' 我可以拖放该层中的任何员工,以安排他们的工作时间。
在调度程序中,我的部门(如酒吧、服务等)列在左侧。右侧是接下来的几天可见。
目前我试过这个功能:
eventOverlap: function(stillEvent, movingEvent) {}
因此,如果我将“haris bjelic”拖放到“WL from 01.06 - 04.06”,如果它们重叠在一起,我就可以访问这两个事件。因此,我尝试获取“可拖动”事件的 ID 和“WL 从 01.06 - 04.06”的 ID,以便在数据库的关系中设置它。
如果完成,我想将员工姓名附加到工作层的“标题”。如果我将“Haris Bjelic”和其他员工拖放到“WL from 01.06 - 04.06”,结果需要如下所示:
'WL 01.06 - 04.06
"Haris Bjelic"
"Foo Employe"
2 emplyoee are working in this Layer'
通过 eventOverlap 函数,我可以访问这两个事件。目前,当我将“haris bjelic”拖到另一个事件并触发 Overlap 函数时,我想更改工作层的标题。
在 eventOverlap 中我尝试了这个:
stillEvent.text += "\n" + movingEvent.text;
element.fullCalendar('updateEvent', stillEvent);
它创建了一个新的事件,而不是仅更改文本!
看这里:
为什么 updateEvent 会创建一个新的事件而不是更新旧的事件?我将 stillEvent 放在 updateEvent 函数中。
最佳答案
事件中没有text
属性,是title
。标题更新后,我还使用此代码从日历中删除 movingEvent:
eventOverlap: function(stillEvent, movingEvent) {
stillEvent.title += "\n" + movingEvent.title;
$('#calendar').fullCalendar('updateEvent', stillEvent);
$('#calendar').fullCalendar('removeEvents', movingEvent._id);
return false;
},
eventReceive: function(event) { // called when a proper external event is dropped
$('#calendar').fullCalendar('removeEvents', event._id);
},
此代码适用于与 fullCalendar 捆绑在一起的外部拖动演示。
关于javascript - 如何在另一个事件中添加一个事件 - fullcalendar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38154284/
我是一名优秀的程序员,十分优秀!