【发布时间】:2012-03-16 19:26:24
【问题描述】:
不幸的是,FullCalendar 网站上的相关文档有点少。
我有 3 个事件源,我想使用一系列 3 个复选框,选中时将显示该事件源,未选中时将隐藏它。
addEventSource 的方法是.fullCalendar( 'addEventSource', source )
removeEventSource 的方法是.fullCalendar( 'removeEventSource', source )
我正在使用根据文档的 FullCalendar 1.5.3
从 1.5 版本开始,source 参数变得相当宽松。您可以提供事件源的 Array/URL/Function,也可以指定完整的事件源对象。
我是否仍然在主 fullCalendar 设置中指定我的 EventSources,然后使用上述方法,如果是这种情况,在我的情况下 source 是什么?
以下是我的事件来源:
eventSources: [ //sets up where we will get the data for claims (fullCalendar refers to them as events)
{
url: '../Users/json-events.aspx', //file which generates a json feed
type: 'GET',
allDay: false,
editable: false,
data: { //extra params that will signify which sql script to use
e: 'tsb', //gets tsb claims
c: ccview, //for this cost centre
t: tview, //for this team
p: pid //for this pid
},
error: function () {
alert('There was an error while fetching TSB claims');
},
color: '#a6b28c', //background color of block
textColor: 'black' //text colour of block
},
{
url: '../Users/json-events.aspx',
type: 'GET',
allDay: false,
editable: false,
data: {
e: 'co', //get call out claims
c: ccview, //for this cost centre
t: tview, //for this team
p: pid //for this pid
},
error: function () {
alert('There was an error while fetching Call-Out claims');
},
color: '#ea9473',
textColor: 'black'
},
{
url: '../Users/json-events.aspx',
type: 'GET',
allDay: false,
editable: false,
data: {
e: 'ot', //get overtime claims
c: ccview, //for this cost centre
t: tview, //for this team
p: pid //for this pid
},
error: function () {
alert('There was an error while fetching Overtime claims');
},
color: '#a8bac8',
textColor: 'black'
}
],
如您所见,我使用的是相同的 URL(不同之处在于 'e' 参数)
【问题讨论】:
-
在玩了很多之后,我第一次让系统删除事件。问题是将它们带回来。我终于让它们回来了,但它们以标准的蓝色而不是指定的颜色返回。有人有什么想法吗?
-
好的,让我们尝试用另一种方式给猫换皮...我可以加载所有事件,然后根据复选框的值隐藏或显示这些特定事件的 div 吗?我会寻找什么 div?我假设它们具有相同的 div 但具有不同的样式属性。
标签: jquery fullcalendar