一天中的列(Dojo Toolkit dojox.Calendar)

时间:2016-07-28 18:10:01

标签: javascript calendar dojo dojox.calendar

我的dojox.calendar功能有问题。简而言之,我正在尝试将子列放入日历中,并将“day”作为dateInterval。我已阅读并尝试了以下链接:http://livedocs.dojotoolkit.org/dojox/calendar#sub-columns

colView.set("store", new Memory({data:[
  {
    summary: "My Event",
    startTime: new Date(2013, 0, 1, 10, 0),
    endTime: new Date(2013, 0, 1, 14, 0),
    calendar: "cal1"
  }
]})**)**;

colView.set("subColumns", ["cal1", "cal2"]);

我的虚拟代码在这里

function(parser, ready, Calendar, Observable, Memory, Deferred, ColumnView, ColumnViewSecondarySheet) {
    ready(function() {
            someData = [{
                id: 0,
                summary: "Default Work",
                begin: new Date(2016, 0, 1, 10, 0),
                end: new Date(2016, 0, 1, 12, 0)
            }];

            calendar = new Calendar({
                date: new Date(2007, 10, 21),
                startTimeAttr: "begin",
                endTimeAttr: "end",
                store: new Observable(new Memory({
                    data: someData
                })),
                dateInterval: "month",
                style: "position:relative;width:750px;height:500px"
            }, "someId");

            var colView = calendar.columnView;
            colView.set("subColumns", ["cal1", "cal2"]);

            colView.set("store", new Memory({
                data: [{
                    summary: "My Event",
                    startTime: new Date(2007, 10, 21, 10, 0),
                    endTime: new Date(2007, 10, 21, 11, 0),
                    calendar: "cal1"
                }]
            }));
        )
    }

在结果中,它会显示一天中的子列,但我无法将事件放置到那些子列The screenshot from dummy code 我该如何解决这个问题?

感谢您的帮助,对不起我的英语。

1 个答案:

答案 0 :(得分:0)

日期属性设置为2007,而您的数据反映了2016年的日期。

此外,您已更改startTimeAttr和endTimeAttr。您的数据应该相应地反映出来。

 function(parser, ready, Calendar,Observable,Memory,Deferred,ColumnView,ColumnViewSecondarySheet){
            ready(function(){
                someData = [
                            {
                              id: 0,
                              summary: "Default Work",
                              begin: new Date(2016, 0, 1, 10, 0),
                              end: new Date(2016, 0, 1, 12, 0)
                            }
                          ];
                          calendar = new Calendar({
                            date: new Date(2007, 10, 21),
                            startTimeAttr: "begin",
                            endTimeAttr: "end",
                            store: new Observable(new Memory({data: someData})),
                            dateInterval: "month",
                            style: "position:relative;width:750px;height:500px"
                          }, "someId");
                          var colView = calendar.columnView;
                            colView.set("subColumns", ["cal1", "cal2"]);
                            colView.set("store", new Memory({data:[
                            {
                               summary: "My Event",
                               begin: new Date(2007, 10, 21, 10, 0),
                               end: new Date(2007, 10, 21, 11, 0),
                               calendar: "cal1"
                             }
                           ]}));
 )}