2016-02-12 44 views

回答

1

我相信同事的礦用dayRender幾天前爲此確切的目的。

像這樣的東西可能會工作,但它是未經測試的代碼。

dayRender: function (date, cell) { 
    cell.text(moment(date).format('DD')); 
} 

我們正在使用moment.js庫格式化單元格上的日期。

0

這就是我使用的,它有點複雜,但你可能會找到你想要做的。 它使用一個JS函數來改變提供給FullCallendar的事件列表和一個JS鉤子以在特定事件上添加一個html標記(Glyphicon)。

// JSON of all events 
var allEvents = <?php echo $json; ?>; 

    // set the fullCalendar 
$('#calendar').fullCalendar({ 

    header: { 
    left: '', 
    center: 'title', 
    right: 'prev,next today' 
    }, 
    weekends:false, 
    fixedWeekCount:false, 
    // our own JS function to filter the event 
    events: function(start, end, timezone, callback) { 
    var filteredEvents = []; 
    var noDuplicateAssignment = []; 
     // we walk on every event to filter every duplicate 
    $.each(
     allEvents, 
     function (key, oneEvent) { 
      // we just display allUnique 
     if (noDuplicateAssignment.indexOf(oneEvent.id) < 0) { 
      filteredEvents.push(oneEvent); 
      noDuplicateAssignment.push(oneEvent.id); 
     } 
     } 
    ); 
     // we supply our events to the fullCalendar callback 
    callback(filteredEvents); 
    }, 
    // hook to add the glyphicon on electronic==TRUE event 
    eventRender: function (event, element) { 
    if(event.electronic) 
     element.find('.fc-content').prepend(
     '<i class="glyphicon glyphicon-envelope"></i> ' 
     ); 
    } 
}); 

如果你正在談論的內容,最好是使用JSON格式的輸入數據。

使用Json,您可以編輯JavaScript Json對象並調用此新對象的渲染以獲得您想要的效果。 http://fullcalendar.io/docs/event_data/events_array/

+0

我已經從JSON獲取事件來呈現事件,但我不知道如何獲得那些日子在天細胞底部的數字:( – miechooy

+0

@miechooy什麼?請多說明一下你想要的問題,因爲它似乎我絕對不明白其實......只是把日期號碼放在單元格的底部? – Blag

+0

我想把自己的文字改爲 – miechooy

相關問題