我想在我的fullcalendar标题中添加一个按钮,该按钮仅在周视图中显示。
我不确定如何检测日历当前是否在周视图中。有没有办法实现这个目标?
目的是我需要用户能够点击一个按钮来确定他们已经完成了那周的活动。
感谢您的帮助!
答案 0 :(得分:1)
jQuery('#calendar').fullCalendar( 'getView' ).name
- 这应该会返回您的观点
在此处查看更多信息: http://arshaw.com/fullcalendar/docs/views/getView/
答案 1 :(得分:0)
添加viewRender
回调,
$('#calendar').fullCalendar({
...
viewRender: function(view, element){
if(view.name.indexOf('Week') != -1) {
// add button to header left
$('.fc-header-left').append('<span class="fc-header-space"></span><span class="fc-button fc-state-default fc-corner-left fc-corner-right">Button</span>');
}
},
...