Repeat events on FullCalendar base on date start and end

大兔子大兔子 提交于 2020-01-03 05:38:05

问题


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>");
                  }
               }
        });
    }   

回答1:


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.



来源:https://stackoverflow.com/questions/47862871/repeat-events-on-fullcalendar-base-on-date-start-and-end

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!