FullCalendar - 显示不同的信息 [英] FullCalendar - displaying different info
问题描述
如何在周视图和日视图中显示(更改内部代码)以显示不同的信息f.ex.:
周视图 - 时间,标题
日视图 - 时间,标题,描述等。
$ b
和pro-forma:month view - time,title
,
var currentView;
在fullCalendar的构造函数中有 viewDisplay 触发器,使用此代码。
viewDisplay :function(view){
//这是非常丑陋的方式来改变交换机上的事件...但它的工作原理!
//每次你使用'gotoDate'时,都会触发,同时按下一个,前一个
if(view.name!= currentView){
if(view.name =='basicWeek')
{
$('#myDateSelector')。hide();
$('#calendar')。fullCalendar('removeEventSource','json_day.php');
$('#calendar')。fullCalendar('addEventSource','json_week.php');
console.log(week); (view.name =='basicDay')
{
$('#myDateSelector')。show();
if
$('#calendar')。fullCalendar('removeEventSource','json_week.php');
$('#calendar')。fullCalendar('addEventSource','json_day.php');
console.log(day);
}
//您可以在其他地方使用它来快速了解哪些视图处于活动状态
currentView = view.name;
}
},
这段代码很hacky,但它很多比在日历的源代码中挖掘更好。您必须记得添加和删除任何提要,通常您会注意到您的提要开始复制..这意味着有一个删除丢失的地方。
The question is:
how to display (what to change inside code) to display different info in week view and in day view f.ex.:
week view - time, title
day view - time, title, description ect.
and pro-forma: month view - time, title
In the global JS declare,
var currentView;
In the constructor of fullCalendar there is viewDisplay trigger, use this code.
viewDisplay: function(view) {
//This is very ugly way to change events on switch... but it works!
//Every time you you use 'gotoDate' this will trigger, also pressing next, previous
if (view.name != currentView) {
if ( view.name == 'basicWeek' )
{
$('#myDateSelector').hide();
$('#calendar').fullCalendar( 'removeEventSource', 'json_day.php' );
$('#calendar').fullCalendar( 'addEventSource', 'json_week.php' );
console.log("week");
}
if (view.name == 'basicDay' )
{
$('#myDateSelector').show();
$('#calendar').fullCalendar( 'removeEventSource', 'json_week.php' );
$('#calendar').fullCalendar( 'addEventSource', 'json_day.php' );
console.log("day");
}
//You can use it some where else to know what view is active quickly
currentView = view.name;
}
},
The code is very hacky, but it is much better than digging in the source code for the calendar. You must remember to add and remove any feeds, usually you will notice that your feeds start to duplicate.. this means there is a remove missing somewhere.
这篇关于FullCalendar - 显示不同的信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!