全日历月视图如何添加自定义列

时间:2018-10-02 06:02:55

标签: fullcalendar

是否可以在月视图中添加自定义/总计列?

enter image description here

1 个答案:

答案 0 :(得分:0)

eventAfterAllRender: function (view) {
    $(view.headRowEl).find('tr > .cc-total').remove();
    $(view.el).find('td.fc-day-number').closest('tr').find('.cc-total').remove();

    $(view.headRowEl).find('tr').append('<th class="fc-day-header fc-widget-header fc-sun cc-total">Total</th>');
    $(view.el).find('td.fc-day-number').closest('tr').append('<td class="cc-total"></td>');

    var rows = $(view.el).find('.fc-row.fc-week');
    for (var i = 0; i < rows.length; i++) {
        $(rows[i]).find('td.fc-day').closest('tr').find('.cc-total').remove();
        $(rows[i]).find('td.fc-day').closest('tr').append('<td class="cc-total" style="vertical-align: middle;" align="center"><b>' + total + '</b></td>');
    }
}