How to combine jquery date-picker and jquery full calendar

青春壹個敷衍的年華 提交于 2019-12-03 16:59:52

Take a look at this : Issue 167: Mini Calender to control Main Calender.

Or make the combination with following example :

$(document).ready(function() {
    $("#fullcalendar").fullCalendar({
        // .....
    });

    $('#datepicker').datepicker({
        inline: true,
        onSelect: function(dateText, inst) {
            var d = new Date(dateText);
            $('#fullcalendar').fullCalendar('gotoDate', d);
        }
    }); 
}

<div id="fullcalendar"></div>
<div id="datepicker"></div>

The "gotoDate (method)" would help you select a date programatically in fullcalendar. So let the user select a date using jquery date picker and register a onchange event on the text input that captures the date. When the onchange fires, use gotoDate to set the date in fullcalendar. Refer - http://arshaw.com/fullcalendar/docs/current_date

This might help anyone coming to this answer to add a gotoDate datepicker to fullcalendar as a custom button

customButtons: {
    gotoDate: {
        text: 'Go to date',
        click: function () {
            $(this).datepicker({
                autoclose: true
            });
            $(this).datepicker().on('changeDate', function (e) {
                $('#fullcalendar').fullCalendar('gotoDate', e.date);
            });
            $(this).datepicker('show');
        }
    },
},
footer: {
    'center': 'gotoDate'
},
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!