我们如何在每个资源日期单元格上显示自定义文本?

时间:2019-03-26 22:48:43

标签: javascript fullcalendar fullcalendar-scheduler

我正在设置带有fullcalendar-scheduler的日历。我们如何在特定资源的每个日期单元格上添加自定义文本?

我尝试通过dayRender()函数进行添加,但是它仅添加一个特定日期,而不是添加不同资源的每个日期。

$('#fleet_calendar').fullCalendar({
    selectable: true,
    defaultView: 'timelineEightDays',
    defaultDate: this.state.defaultDate,
    views: {
    timelineEightDays: {
        type: 'timeline',
        duration: { days: 8 },
        slotDuration: '24:00'
    }
    },
    header: {
    left: 'prev',
    right: 'next',
    center: 'title'
    },
    resources: this.state.rvs,
    resourceRender: function(resourceObj, labelTds, bodyTds) {
    labelTds.css('background-image', "url(" + resourceObj.header_image + ")");
    },
    resourceLabelText: 'Resources',
    dayClick: function(date, jsEvent, view, resource) {
    alert('clicked ' + date.format() + ' on resource ' + resource.id);
    },
    dayRender: function(date, cell){
    cell.append('<span>$40</span>');
    console.log(date.format('YYYY/MM/DD'));
    },
    select: function(startDate, endDate, jsEvent, view, resource) {
    // alert('selected ' + startDate.format() + ' to ' + endDate.format() + ' on resource ' + resource.id);
    },
    events: this.state.events,
    eventRender: function(event, element, view){
    },
    schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives'
});

enter image description here

0 个答案:

没有答案