Fullcalendar custom buttons in header

别来无恙 提交于 2019-12-04 07:35:48

Custom buttons in header is already supported by the fullcalendar plugin. Not needed to add ad-hoc code

$("#calendar").fullCalendar({
    customButtons: {
        reload: {
            text: 'Reload',
            click: function() {
               //you code 
            }
        }
    },
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'reload'
    },
 });

Check the example in the scheduler:

// ad-hoc way of getting an add button in there.
// for a better solution, please star this issue:
//  https://code.google.com/p/fullcalendar/issues/detail?id=225
$('.fc-toolbar .fc-left').prepend(
    $('<button type="button" class="fc-button fc-state-default fc-corner-left fc-corner-right">+ room</button>')
        .on('click', function() {
            var title = prompt('Room name');
            if (title) {
                $('#calendar').fullCalendar(
                'addResource',
                { title: title },
                true // scroll to the new resource?
             );
        }
    })
);

Here : http://fullcalendar.io/js/fullcalendar-scheduler-1.0.0-beta/demos/dynamic-add-remove.html

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