2017-01-26 24 views
0

我正在嘗試格式化以下fullcalendar視圖的列標題。Fullcalendar視圖columnFormat正在被嵌入

views: { 
     timeline7Days: { 
      columnFormat: 'ddd D/M', 
      type: 'timelineWeek', 
      slotDuration: '24:00', 
      duration: { days: 7 }, 
      buttonText: 'resource week', 
      resourceEditable: false 

    }, 

基本上,它忽略「DDD d/M」,並顯示與「沫16」而不是「星期一1/16」的標題的每個列的列格式。有任何想法嗎?

click here for jsbin

回答

0

有肯定有毛病columnFormat自定義視圖。你可以試試這樣的把戲:

viewRender: function(view, element) { 
     if (view.name == 'timeline7Days') { 
    $("th[data-date]").each(function(){ 
     $(this).find('span').text(moment($(this).data().date).format('ddd M/D')); 
    }); 
     } 
    } 

希望有幫助!
祝你好運
Krzysztof

0

謝謝,你的例子並不完全正常,但它幫助我走上了正軌。

我結束了使用下面的代碼(替換 '跨越' 與 'A'。 '代碼'

if ((view.name == 'timeline7Days') || (view.name = 'timelineMonth')) 
      { 
       $("th[data-date]").each(function() 
       { 
        $(this).find('a').text(moment($(this).data().date).format('ddd M/D')) 
       }); 
      }