2

我对 FullCalendar (FC) 有问题,它是插件 Scheduler (S)。

几个月以来,我将 1.2.0 (S) 版本与 2.6.0 (FC) 一起使用。

没关系,但是使用“动态获取/设置选项”功能可以极大地满足我们用户的新请求(启用/禁用资源分组)。所以我下载了库的新版本,1.4.0 (S) 和 3.0.1 (FC)。

问题来了:使用正常的调度程序日视图,它工作得很好。但是,当我打开一个使用每周视图的新页面时,没有显示任何数据。

我已经尝试了一切:

  • 更改了版本,使用 2.7.3 (FC) 和 1.3.2 (S)。
  • 使用与(S)一起打包在zip中的(FC)版本。
  • 进行了一些更改后,我删除了它们,但问题似乎在于库一起运行的方式。

我会发布一些代码,但它有点复杂......调度程序被封装在一个“类”中,并使用事件激活。整个基础设施是一种框架的一部分,我不能简单地拿一部分代码。我敢肯定,整个版本都适用于旧版本,但不适用于新版本。

到目前为止,唯一可行的解​​决方案是使用两个版本,每个页面一个。但是,当然,这是一种 hack,不好,也不利于维护。

这是用于生成调度程序的代码。_schedulerType用于创建每日或每周视图。两个“容器”,_schedulerOptions_schedulerServices外部创建,用于定义调度程序的创建方式。

_schedulerContainer.fullCalendar({
    local (or lang): _schedulerOptions.language,
    allDaySlot: false,
    now: _currentDay,
    selectable: true,
    editable: false,
    aspectRatio: _schedulerOptions.aspectRatio,
    scrollTime: '07:30',
    slotDuration: '00:15:00',
    slotLabelInterval: '01:00:00',
    slotLabelFormat: _schedulerOptions.slotLabelFormat,
    slotWidth: _schedulerOptions.slotWidth,
    nowIndicator: true,
    customButtons: (_schedulerServices.schedulerHeader !== null) ?
        _schedulerServices.schedulerHeader.createCustomButtons() :
        null,
    header: (_schedulerServices.schedulerHeader !== null) ?
        _schedulerServices.schedulerHeader.createHeader() :
        false,
    defaultView: _schedulerType,
    -------------------REMOVE-----------------------------------------
    resourceLabelText: 'Rooms',
    resourceGroupField: _defaultOptions.groupBy,
    resourceOrder: _defaultOptions.orderBy,
    resources: 
      function (callback) {
        if (_schedulerServices.rscCallback !== null) {
          if (log) {
              console.log("reload resources inside scheduler");
          }

          callback(_schedulerServices.rscCallback.getResources());
        }
      },
    ------------------------------------------------------------------
    events: 
      function (start, end, timezone, callback) {
        if (_schedulerServices.evtCallback !== null) {
          if (log) {
            console.log("reload events inside scheduler");
          }
         callback(_schedulerServices.evtCallback.getEvents());
        }
      },
    -------------------REMOVE-----------------------------------------
    resourceRender: 
      function (resourceObj, element) {
        if (_schedulerServices.rscViewManager !== null) {
          return _schedulerServices.rscViewManager.requestRender(resourceObj, element);
        }
      },
    ------------------------------------------------------------------
    eventRender: 
      function (eventObj, element) {
        if (_schedulerServices.evtViewManager !== null) {
          return _schedulerServices.evtViewManager.requestRender(eventObj, element);
        }
      }
    });

任何帮助,将不胜感激!谢谢


解决了!!!

在 2.6.0 版本之后,不应使用选项中未使用的选项字段。就我而言,删除与资源相关的所有字段解决了这个问题。

4

0 回答 0