fullcalendar - 向全日历添加额外字段

标签 fullcalendar

我需要为我的日历创建更多字段( fullcalendar 用 php 连接到 mysql )。我一直在阅读 eventRender 但我不完全确定语法和我应该把它放在哪里。

目前我有以下内容;

$calendar.fullCalendar({
  timeslotsPerHour : 4,
  defaultView:'agendaWeek',
  allowCalEventOverlap : true,
  overlapEventsSeparate: true,
  firstDayOfWeek : 1,
  businessHours :{start: 8, end: 18, limitDisplay: true },
  daysToShow : 7,
        theme: true,
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },

        editable: true,
        events: "json-events.php",
  eventRender : function(calEvent, $event) {
       calEvent.distributor  //this is my new field

  },

但我没有工作,我找不到任何工作示例来比较它。
谢谢

感谢您的反馈,我已经能够使用 eventRender 添加我的自定义字段。所以现在不仅仅是 body 和 description 正在被传递。

我现在的主要问题是将日期值传递给数据库,因为这些没有被保存。有谁知道使用它的任何示例。我真的很感激它。

最佳答案

在 fullcalendar 的第 4 版中,对获取非标准字段进行了一些更改。现在它只接受一个参数作为事件对象:

 events: [
{
  title: 'My Event',
  start: '2010-01-01',
  description: 'This is a cool event'
}
// more events here
],
eventRender: function(info) {
  console.log(info.event.extendedProps.description);
}

注:您可以通过这种方式访问​​附加字段: info.event.extendedProps.description

Check documentation

关于fullcalendar - 向全日历添加额外字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3585481/

相关文章:

asp.net-mvc - jQuery.Load() 不触发 ASP.NET MVC2 中的 Request.IsAjaxRequest

css - 在 Ruby on Rails 中将 Fullcalendar 与 Twitter Bootstrap 结合使用

javascript - Fullcalendar 超薄事件(CSS 错误)

javascript - 全日历星期几三位数

c# - Jquery Fullcalendar (arshaw's) 事件不可编辑

jquery - 全日历事件标题。我不希望每一行都重复

javascript - jquery全日历

javascript - FullCalendar 选择一个月中的某一天返回不正确的周

javascript - 单击下个月或上个月时,在全日历中保留当天的新背景颜色

javascript - 在全日历中单击时更改事件的背景颜色