【问题标题】:Fullcalendar: How to add a new button to the existing buttons in header?Fullcalendar:如何向标题中的现有按钮添加新按钮?
【发布时间】:2016-05-24 10:13:13
【问题描述】:

我正在尝试向标题中的现有按钮添加一个新按钮。我不知道该怎么做。目前,我在标题中有 prev、next、today、month、agendaWeek、agendaDay。我想要一个按钮来添加新事件。这样在单击按钮后,我可以通过弹出窗口添加新事件。

我的代码如下:

$('#calendar').fullCalendar({ 
utc: true, 
header: { 
left: 'prev,next today', 
center: 'title', 
right: 'month,agendaWeek,agendaDay' 
}, 
editable: true, 
droppable: true, 

eventAfterRender: function(event, element, view) { 
element.append(event.title); 
} 

}); 

我的html代码如下:-

<html>
<head>
<meta charset='utf-8' />
<link href='fullcalendar-2.7.1/fullcalendar.css' rel='stylesheet' />
<link href='fullcalendar-2.7.1/fullcalendar.print.css' rel='stylesheet'    media='print' />
<script src='fullcalendar-2.7.1/lib/moment.min.js' type='text/javascript'>   </script>
<script src='fullcalendar-2.7.1/lib/jquery.min.js' type='text/javascript'></script>
<script src='fullcalendar-2.7.1/lib/jquery-ui.min.js'></script>
<script src='fullcalendar-2.7.1/lib/fullcalendar.min.js'></script>
 </head>
 <body>  
 <div id='calendar'></div>
 </body> 

有没有办法通过 FullCalendar 做到这一点?提前谢谢..

【问题讨论】:

    标签: javascript jquery button fullcalendar


    【解决方案1】:

    您可以使用此代码添加自定义按钮:

     $("#calendar").fullCalendar({
        customButtons: {
            add_event: {
                text: 'Add',
                click: function() {
                   alert(); 
                }
            }
        },
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'add_event'
        },
     });
    

    【讨论】:

    • 是的,谢谢pranav,现在我需要一个点击按钮的表格。如何获取表格?
    • 您可以使用引导程序创建模式引用此:mikesmithdev.com/blog/…
    • 你能给我一个小提琴吗?
    • 更新“headerToolbar:”而不是“header”
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-07
    • 2017-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多