Additional fields and rows in FullCalendar V4

北战南征 提交于 2019-12-13 02:55:38

问题


I'm using the latest V4 version of FullCalendar and I can't seem to be able to add additional fields like description and notes in my case. I use the daygrid view and I would like two more fields to appear.

I've tried multiple options from answers here (probably for previous versions) and from the docs, including modifying the main.js from the core folder itself, where the titleHtml and timeHtml are defined (as (core.htmlEscape(eventDef.title)). I managed to add the fields or better said divs, which appear, but without content as eventDef.description is not a valid element, nor is evenDef.notes.

Where can I define these two into eventDef or how to append these fields and display them?

<script>
  document.addEventListener('DOMContentLoaded', function() {
    var calendarEl = document.getElementById('calendar');
    var start = event.start; 
    var element = this;
    var calendar = new FullCalendar.Calendar(calendarEl, {
    plugins: [ 'dayGrid' ],
    defaultView: 'dayGridWeek',
    displayEventEnd:true,
    columnHeaderFormat:{ weekday: 'long', month: 'long', day: 'numeric', omitCommas: true }, 
    titleFormat: { year: 'numeric', month: 'long' },
    header: {center:  'title,prev,next', right:'', left:''},  
      eventTimeFormat: {
          hour: 'numeric',
          minute: '2-digit',
          meridiem: false
        },
      firstDay:1,
       events: [
        <?php get_data();?>
        ],
    });
    calendar.render(); 
  });

</script>

Thanks in advance for any suggestions.


回答1:


eventRender: function(info) { 
  info.el.querySelector('.fc-desc').innerHTML = "" + info.event.description + "";
}

This solved my problem, thanks to ADyson for help.



来源:https://stackoverflow.com/questions/58592548/additional-fields-and-rows-in-fullcalendar-v4

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