在fullcalendar每月视图中选择和取消选择多天

时间:2017-04-07 19:53:18

标签: jquery fullcalendar multi-select

我正在开发一个应用程序,它要求一次选择多天,并在按钮点击时获取该值并将其插入数据库。

以下是我用于实现此目的的代码。但我能够这样做。 任何人都可以帮我解决这个问题吗?

$("#calendar").fullCalendar({
                header: {
                    left: '',
                    center: 'title',
                    right: 'month'
                },
                // defaultDate: CurrentDate[0] + "/01/" + CurrentDate[1],
                navLinks: true,
                editable: true,
                draggable: false,
                eventLimit: true, // allow "more" link when too many events
                events: message.ResponseData,
                selectable: true,
                select: function (start, end, jsEvent, view) {
                    $("#calendar").fullCalendar('addEventSource', [{
                        start: start,
                        end: end,
                        rendering: 'background',
                        //block: true,
                    },]);
                    $("#calendar").fullCalendar("unselect");
                },
                dayClick: function (date, jsEvent, view) {
                    $(".fc-state-highlight").removeClass("fc-state-highlight");
                    $(jsEvent.target).addClass("fc-state-highlight");
                },
                selectOverlap: function (event) {
                    return !event.block;
                }
});

1 个答案:

答案 0 :(得分:0)

为什么不在dayclick上将日期发送到数据库?或者,将日期点击到数组中,然后在按钮单击上发布数组中的所有日期?您还可以为每个日期设置一个布尔值,以检查它是否先前已被选中。