Jquery 从fullcalendar中选择事件id
基于fullcalendar文档,事件对象可以具有唯一标识特定事件的所有实例的id 我的问题是:如果我使用eventClick来选择一个特定的事件,如何在日历上自动选择该事件的所有实例 换句话说,我如何通过选择其中一个来更改在不同日期发生的同一事件的属性(在本例中为背景色) 我的代码如下所示(“newColor”更改所选事件的背景色): 现在,我的代码只是更改所选事件的颜色(此) :重复事件应具有相同的id :函数(事件、jsEvent、视图){} :重复事件应具有相同的idJquery 从fullcalendar中选择事件id,jquery,fullcalendar,Jquery,Fullcalendar,基于fullcalendar文档,事件对象可以具有唯一标识特定事件的所有实例的id 我的问题是:如果我使用eventClick来选择一个特定的事件,如何在日历上自动选择该事件的所有实例 换句话说,我如何通过选择其中一个来更改在不同日期发生的同一事件的属性(在本例中为背景色) 我的代码如下所示(“newColor”更改所选事件的背景色): 现在,我的代码只是更改所选事件的颜色(此) :重复事件应具有相同的id :函数(事件、jsEvent、视图){} :重复事件应具有相同的id :函数(event
:函数(event,jsEvent,view){}将事件加载到日历时,如果事件具有如下结构:
events:[{
id: myspecialid <----- If you provide the same id to the diferent events when
you try do change/access event properties you will change
for all of them that have same id.
start:.....
end: ....
allDay: ....
classname: <------If you want to change event css this is the propertie you have
to use the same way the ID
}]
将事件加载到日历时,如果事件具有如下结构:
events:[{
id: myspecialid <----- If you provide the same id to the diferent events when
you try do change/access event properties you will change
for all of them that have same id.
start:.....
end: ....
allDay: ....
classname: <------If you want to change event css this is the propertie you have
to use the same way the ID
}]
看
这个方法可以解决你的问题
$("#myCalendar").fullCalendar( 'clientEvents', evetnId );
看
这个方法可以解决你的问题
$("#myCalendar").fullCalendar( 'clientEvents', evetnId );
也许2021年的更新是基于Fullcalendar 5.7的,以防发生变化。 根据文件 如下所示的日历实例显示了将应用于我的解决方案的答案
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
eventClick: function(info) {
console.log('Event id: ' + info.event.id);
}
}
});
也许2021年的更新是基于Fullcalendar 5.7的,以防发生变化。 根据文件 如下所示的日历实例显示了将应用于我的解决方案的答案
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
eventClick: function(info) {
console.log('Event id: ' + info.event.id);
}
}
});
id
是唯一的标识符。您可以使用类
名称来选择具有相同类
的事件
,感谢您的洞察力,但是对于fullcalendar,calEvent中的id是数组的值,而不是div的id。id
是唯一标识符。您可以使用类
名称来选择具有相同类
的事件
,感谢您的洞察力,但是对于fullcalendar,calEvent中的id是数组的值,而不是div的id。好的,很好。问题是:我如何选择calEvent.id,以便它们在我单击(此)的同时全部更改。请参见编辑,您可以选择这样的id并按您想要的方式使用它。这是您正在寻找的吗?不是真的,因为我已经对(此)进行了更改,但没有对具有相同id的其他实例进行更改。无论如何,谢谢!非常有用,谢谢-虽然它是类名。基本上为事件分配一些独特的内容,例如。。。类名:changeMe+ID然后$('.changeMe'+event.ID').css('border-color','red');好的,太好了。问题是:我如何选择calEvent.id,以便它们在我单击(此)的同时全部更改。请参见编辑,您可以选择这样的id并按您想要的方式使用它。这是您正在寻找的吗?不是真的,因为我已经对(此)进行了更改,但没有对具有相同id的其他实例进行更改。无论如何,谢谢!非常有用,谢谢-虽然它是类名。基本上为事件分配一些独特的内容,例如。。。类名:changeMe+ID然后$('.changeMe'+event.ID').css('border-color','red');