Fullcalendar 如何更改事件的资源
FullCalendar 4.0中更改了资源的处理 在FullCalendar 3.x中,我使用以下方法更改了事件的资源:Fullcalendar 如何更改事件的资源,fullcalendar,fullcalendar-4,Fullcalendar,Fullcalendar 4,FullCalendar 4.0中更改了资源的处理 在FullCalendar 3.x中,我使用以下方法更改了事件的资源: event.resourceId=newResourceId; 在FullCalendar 4.0中,我找不到正确的方法。。。 我目前的代码是: var calendar\u event=calendar.getEventById(data.event.id) if(日历事件){ 日历\u event.setProp('title',data.event.title) c
event.resourceId=newResourceId;
在FullCalendar 4.0中,我找不到正确的方法。。。
我目前的代码是:
var calendar\u event=calendar.getEventById(data.event.id)
if(日历事件){
日历\u event.setProp('title',data.event.title)
calendar_event.setProp('resourceId',[data.event.resourceId])
}
setProp
似乎不是正确的方法,因为事后事件没有反映网格内的更改,只有标题更改为新的
getResources()
的设置程序不存在,例如setResources()
上的官方文档仅包括资源获取,而不以编程方式将新的资源获取设置为现有事件
《迁移指南》只提到了替换updateEvent
的方法setProp
,setExtendedProp
,setEnd
,setDates
,setAllDay
,moveStart
,moveDates
,缺少资源
我当前的解决方法是删除并再次添加事件:
calendar.getEventById(data.event.id).remove()
calendar.addEvent(数据.事件)
如何在不再次加载和初始化整个事件的情况下将事件移动到另一个资源中?编辑事件的资源已经完成 下面描述了该用法: 按ID:
var event = calendar.getEventById('1');
event.setResources([ 'a' ]); // set a single resource
event.setResources([ 'a', 'b' ]); // set multiple
按资源分列:
var resourceA = calendar.getResourceById('a');
var resourceB = calendar.getResourceById('b');
var event = calendar.getEventById('1');
event.setResources([ resourceA, resourceB ]);
你找到解决办法了吗?您是对的,setProp不起作用,查看源代码setProp会检查一个名为NON_DATE_PROPS的常量,而resourceIds不在其中。我还没有迁移,但这是我将面临的问题。setProps:NON_DATE_PROPS:@AllyMurray还没有。目前我正在使用上面提到的解决方法。我刚刚在fullcalendar scheduler()中提出了一个问题。现在,在v4.0.2中使用Event::setResources可以实现这一点