0

我正在使用 gem fullcalendar-rails。

我对数据使用 ajax,对事件输入使用模态。

在事件模式添加新记录后,我使用全refectchevents日历在日历上显示新事件。这适用于我测试过的所有浏览器,除了 IE 9。

这是代码:

  $('#calendar').fullCalendar
    ignoreTimezone: true,
    editable: true,
    defaultView: 'month',
    height: 500,
    slotMinutes: 30,
    selectable: true,
    selectHelper: true,
    editable: false,

    select: (start, end, allDay) ->
      title = $("#title")
      description = $("#description")
      hours = $("#hours")
      workorder = $("#workorder_id")
      actcode = $("#actcode_id")
      $("#dialog-form").dialog
        autoOpen: true
        height: 500
        width: 400
        modal: true
        buttons:
          "Create Labor": ->
           $.create "/events/",
             event:
                workorder_id: workorder.val(),
                actcode_id: actcode.val(),
                title: title.val(),
                description: description.val(),
                hours: hours.val(),
                starts_at: "" + start,
                ends_at: "" + end,
                all_day: allDay,
                maxsynch: "N",
                employee_id: $('#calendar').data('employeeid'),
                overtime: "TRUE" if $("#overtime").is(":checked")
            $(this).dialog "close"
            $('#calendar').fullCalendar('refetchEvents')

更新1

我更改了以下内容 - 但是,它没有解决它。

   eventSources: [{
     url: '/events',
     cache: false,
   }],

更新2

这有效:

...
  employee_id: $('#calendar').data('employeeid'),
  overtime: "TRUE" if $("#overtime").is(":checked")
complete: ->
  $('#calendar').fullCalendar('refetchEvents')
4

1 回答 1

0

我遇到了类似的问题,但我没有使用带有导轨的完整日历。

IE 缓存数据所以每次调用 refetch 事件时,它都会显示缓存的事件。

我使用 events_function 来获取事件。我在 ajax 请求中设置了 cache: false 选项来获取事件。它在我的情况下有效。

于 2013-05-31T08:06:24.777 回答