duanjie9630 2012-02-23 09:48
浏览 164
已采纳

FullCalendar - 显示不同的信息

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

  • 写回答

3条回答 默认 最新

  • douzhunlan5930 2012-02-27 22:27
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 MATLAB怎么通过柱坐标变换画开口是圆形的旋转抛物面?
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿