Fullcalendar doesn't adjust the height of cells with customised events when first loaded

守給你的承諾、 提交于 2019-12-13 05:36:02

问题


The customised events are rendered as expected, but the day cells don't grow in height to include the events at the initial load. If I change the size of the window, or click on another view, and change back to the month view, it renders correctly. Then if an event is triggered (date click or event click), the calendar rerenders the same way as the initial load.

I tried rerendering the calendar in 'datesRender' function with this.render(), but it's not ideal to load everything twice, also it has a flicking effect when clicking on a date or event.

...
const renderEvent = ({ event, el }) => {
   const eventComponent = (
      <div className="wrapper">
         Event content here
      </div>
   );

   ReactDOM.render(eventComponent, el);
};
...
<FullCalendar
    defaultView='dayGridMonth'
    plugins={[dayGridPlugin, timeGridPlugin, interactionPlugin]}
    header={{
        left: 'prevYear,nextYear',
        center: 'title',
        right: 'dayGridMonth,timeGridWeek,timeGridDay today prev,next'
    }}
    weekends={true}
    events={events}
    dateClick={handleDateClick}
    handleWindowResize={true}
    eventRender={renderEvent}
    eventClick={function(info) {
        handleEventClick(info.event.id);
    }}
    datesRender={function(info) {
        // this.render();
    }}
/>
...

I would like the calendar render properly with the initial load.

来源:https://stackoverflow.com/questions/56289522/fullcalendar-doesnt-adjust-the-height-of-cells-with-customised-events-when-firs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!