2017-01-11 11 views
-1

が、完全なカレンダーの背景テキストを追加することが可能であろうイベントがないときの日が見つかりイベントがないとき下さい完全なカレンダーは -

例えば enter image description here

+0

なぜdown vote? – dEL

答えて

2

ただ、助けを必要とし、その日にテキストを追加します考え:

$('#calendar').fullCalendar({ 

    defaultView: 'month', 
    events: [{ 
    title: 'event', 
    start: '2017-01-05 11:00', 
    end: '2017-01-06 13:00', 
    }, { 
    title: 'event 2', 
    start: '2017-01-18' 
    }], 
    dayRender: function(date, cell) { 
    cell.append('<div class="unavailable">Unavailable</div>'); 
    }, 
    eventAfterAllRender: function(view) { 
    var dayEvents = $('#calendar').fullCalendar('clientEvents', function(event) { 
     if (event.end) { 
     var dates = getDates(event.start, event.end); 
     $.each(dates, function(index, value) { 
      var td = $('td.fc-day[data-date="' + value + '"]'); 
      td.find('div:first').remove(); 
     }); 
     } else { 
     var td = $('td.fc-day[data-date="' + event.start.format('YYYY-MM-DD') + '"]'); 
     td.find('div:first').remove(); 
     } 
    }); 
    } 
}); 

function getDates(startDate, endDate) { 
    var now = startDate, 
    dates = []; 

    while (now.format('YYYY-MM-DD') <= endDate.format('YYYY-MM-DD')) { 
    dates.push(now.format('YYYY-MM-DD')); 
    now.add('days', 1); 
    } 
    return dates; 
}; 

お試しくださいfiddle

よろしくお願いいたします。
Krzysztof

+0

答えをありがとう、私は数分でショットを与える – dEL

+0

問題はありません!希望が役立ちます。 –

+0

私の見解はhttps://fullcalendar.io/js/fullcalendar-scheduler-1.5.0/demos/scale.html [月間表示]ですので、ソリューションの実装には時間がかかります – dEL

関連する問題