基于日期开始和结束在FullCalendar上重复事件 [英] Repeat events on FullCalendar base on date start and end
问题描述
默认情况下,FullCalendar将事件库扩展到开始日期直到结束日期。例如,
{
title:2,
start:2017 -12-17,
end:2017-12-20,
icon:fa-truck
},
我的问题是有点类似这里 FullCalendar中的重复发生的事件,但是这个使用时间和星期几。 p>
我想要的是,卡车事件将在2017年12月17日,2017年12月18日,2017年12月19日2017年 - 12-20。
这是我的代码。
函数日历(event.icon){
'('#calendar')。fullCalendar {
el ement.find(.fc-event-title)。prepend(< i class ='fa+ event.icon +'>< / i>);
}
}
});
}
生成服务器端代码以下列格式返回您的json。您可以使用javascript与硬性值进行交叉检查。
{
pre>
title:2,
start:2017-12-17,
end:2017-12-17,
icon:fa-truck
} ,
{
title:2,
start:2017-12-18,
end:2017-12-18,
icon:fa-truck
},
{
title:2,
start:2017-12-19 ,
end:2017-12-19,
icon:fa-truck
},
等等...
您可以将上面的json分配给data var和check。然后更新服务器端代码。
By default, FullCalendar stretches the event base on the starting date up to end date. For example,
{ "title": "2", "start": "2017-12-17", "end": "2017-12-20", "icon": "fa-truck" },
My problem is kinda similar here Recurring Events in FullCalendar, but this one uses time and days of week.
What I want is that the event "Truck" will keep appearing every date, from 2017-12-17, 2017-12-18, 2017-12-19, 2017-12-20.
This is my code.
function calendar(data){ $('#calendar').fullCalendar({ events: data, eventRender: function(event, element) { if(event.icon){ element.find(".fc-event-title").prepend("<i class='fa "+event.icon+"'></i>"); } } }); }
解决方案Generate server side code which will return you json in following format. You can cross check this using javascript as well with hard values.
{ "title": "2", "start": "2017-12-17", "end": "2017-12-17", "icon": "fa-truck" }, { "title": "2", "start": "2017-12-18", "end": "2017-12-18", "icon": "fa-truck" }, { "title": "2", "start": "2017-12-19", "end": "2017-12-19", "icon": "fa-truck" },
AND so on...
You can assign above json to data var and check. and then update the server side code.
这篇关于基于日期开始和结束在FullCalendar上重复事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!