FullCalendar V4中的其他字段和行 [英] Additional fields and rows in FullCalendar V4

查看:258
本文介绍了FullCalendar V4中的其他字段和行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是FullCalendar的最新V4版本,我似乎无法添加其他字段,例如我的情况下的说明和注释. 我使用daygrid视图,希望再出现两个字段.

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.

我从这里的答案(可能是以前的版本)和文档中尝试了多个选项,包括修改核心文件夹本身中的main.js,其中定义了titleHtml和timeHtml(如(core.htmlEscape(eventDef .标题)). 我设法添加了出现的字段或更佳的div,但是这些字段没有内容,因为eventDef.description不是有效的元素,evenDef.notes也不是.

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.

我在哪里可以在eventDef中定义这两个字段,或者如何附加这些字段并显示它们?

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.

推荐答案

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

这解决了我的问题,感谢ADyson的帮助.

This solved my problem, thanks to ADyson for help.

这篇关于FullCalendar V4中的其他字段和行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆