简体   繁体   English

FullCalendar拖动多个事件

[英]FullCalendar Dragging Multiple Events

I would like to select (via check box) multiple events on the FullCalendar and then move all selected events together to a different date/time. 我想在FullCalendar上选择(通过复选框)多个事件,然后将所有选定的事件一起移动到不同的日期/时间。

I have gotten as far as placing check boxes inside events. 我已经在事件中放置了复选框。 But not sure how to go further. 但不确定如何走得更远。

Note that I know about using the id variable which is used for recurring events. 请注意,我知道使用用于重复事件的id变量。 I would like to avoid using the id variable if possible and go down the check box route of selecting and moving multiple events. 我想尽可能避免使用id变量,而是选择和移动多个事件的复选框路线。

Can someone help me get started on moving the selected events? 有人可以帮助我开始移动选定的事件吗?

Thanks 谢谢

EDIT: 编辑:

I've added a non-standard field to the event object called selected which defaults to 0. When the event's checkbox is checked, the selected variable for that event is set to 1. 我已将非标准字段添加到名为selected的事件对象中,该字段默认为0。选中该事件的复选框后,该事件的selected变量将设置为1。

For anyone wanting to do this, here is how I did it: 对于任何想这样做的人,这是我的做法:

  1. In the eventClick method check to see if the checkbox inside the event is checked, if so, set your non-standard event property (selected) to 1 or true. eventClick方法中检查是否选中了事件内的复选框,如果已选中,则将非标准事件属性(选中)设置为1或true。
  2. In the eventDrop method check to see which events have the selected property set to 1 or true and update those events' start and end dates/times. eventDrop方法中,检查哪些事件的selected属性设置为1或true,并更新这些事件的开始和结束日期/时间。
  3. Don't forget to use $('calendar').fullCalendar('updateEvent', event); 不要忘记使用$('calendar').fullCalendar('updateEvent', event); to update the event after changing properties inside eventDrop eventDrop内更改属性后更新事件
  4. Lastly in eventRender which I used to place the checkboxes inside the event elements, make sure that is the events's selected property is 1 or true, the respective checkbox is checked. 最后,在用于将复选框放置在事件元素内部的eventRender中,确保事件的selected属性为1或true,然后选中相应的复选框。

That should do it. 那应该做。

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

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