How to combine jquery date-picker and jquery full calendar

◇◆丶佛笑我妖孽 提交于 2019-12-12 08:12:35

问题


Can any one tell me how I could update a selection in a date picker to a full calendar ie When user selects date from DatePicker then FullCalendar loads events for given date.


回答1:


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>



回答2:


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




回答3:


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'
},


来源:https://stackoverflow.com/questions/7878898/how-to-combine-jquery-date-picker-and-jquery-full-calendar

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