0

我正在尝试使用 dojox.Calendar 显示从 REST 服务器查询的事件,使用 dojo.store.JsonRest (没有 Observable 存储,因为事件是只读的)。

我将初始“dateInterval”模式设置为“月”,以便显示“矩阵视图”并拦截“timeIntervalChange”事件以更改日历存储使用的“查询”,以便在用户在几个月之间移动时按需获取事件。

Everythig 运行良好,但是如果我尝试从“矩阵视图”切换到“列视图”(通过日历导航按钮),即使我看到(从萤火虫控制台)“timeIntervalChange”事件触发和 REST 存储查询定期提交,也不会显示任何事件到服务器。

这是我页面中的 dojox.Calendar 代码片段:

require(["dojo/parser", "dojo/ready", "dojo/_base/xhr", "dojo/date/stamp", "dojo/date/locale", "dijit/Dialog", "dojo/store/JsonRest", "dojox/calendar/Calendar"],
  function(parser, ready, xhr, stamp, locale, Dialog, JsonRest, Calendar) {
    ready(function(){
      var calendarDate = 'the initial ISO date from an MVC model object';
      var query = "";
      var eventStore  = new JsonRest({target: 'the REST service URL'});

      calendar = new Calendar({
                   date: calendarDate,
                   dateInterval: "month",
                   startTimeAttr: "dataOraInizioISO",
                   endTimeAttr: "dataOraFineISO",
                   summaryAttr: "descrizione",
                   decodeDate: function(s){return stamp.fromISOString(s);},
                   encodeDate: function(d){return stamp.toISOString(d);},                   
                   style: "position:relative;width:950px;height:700px",
                   columnViewProps:{minHours:5, maxHours:23, hourSize:40, timeSlotDuration:30},
                   editable: false,
                   selectionMode: "none",
                }, "calendarioIncontri");

      calendar.on("timeIntervalChange", function(e){
          var sStartDate =            
              locale.format(e.startTime,{selector: "date", pattern: "dd/MM/yyyy", fullYear: true});
          var sEndDate =              
              locale.format(e.endTime,{selector: "date", pattern: "dd/MM/yyyy", fullYear: true});

          query = "?" + "dataInizio=" + sStartDate + "&" + "dataFine=" + sEndDate;

          calendar.set('query', query);
          calendar.set('store', eventStore);
      });

请注意,为了避免对所有事件进行初始批量查询(!),我仅在“timeIntervalChange”事件触发时设置日历“存储”和“查询”属性,并注意,据我测试,我需要设置日历“存储”属性每次都让新事件在矩阵视图刷新时显示。

但我仍然无法让事件出现在列视图上!有什么提示吗?

非常感谢罗伯托

4

1 回答 1

0

作为记录(此问题已在 Dojo 邮件列表中得到解答),该用户试图显示 dojox.calendar 不支持的准时事件(当时开始和结束的事件)。如果有人对此功能感兴趣,请在 GitHub 上为项目添加功能愿望:https ://github.com/damiengarbarino/dojo-calendar

于 2013-04-02T13:37:08.063 回答