dojox日历不显示事件

时间:2014-03-25 10:33:57

标签: dojo calendar

我正在尝试使用dojox.Calendar来显示事件,但它不起作用

日历小部件使用其商店属性上的商店集填充数据项列表。 这是dojox.Calendar代码

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <link rel="stylesheet" href="dijit/themes/claro/claro.css">
        <link rel="stylesheet" href="dojox/calendar/themes/claro/Calendar.css">
        <script>dojoConfig = {async: true, parseOnLoad: false,isDebug: true}</script>
        <script src='dojo/dojo.js'></script>

        <script>
            require([
            "dojox/calendar/Calendar",
            "dojo/store/Memory",
            "dojo/_base/Deferred",
            "dijit/_base/manager",      
            "dojo/domReady!"
            ],
            function(Calendar,Memory,Deferred,manager,Observable) {
                var mem = new Memory({data:{    
                                "id":"1",
                                "summary":"Daily Call",
                                "startTime": new Date(2014, 0, 1, 10, 0),
                                "endTime": new Date(2014, 0, 1, 14, 0),

                               }
                        });
                console.log("mem is --->  "+JSON.stringify(mem));   
                calendar = new Calendar({
                        dateInterval:"month",
                        startTimeAttr: "startTime",
                        endTimeAttr: "endTime"  

                    },"calDiv");    

                store: new Observable(new Memory({data: someData})),

                calendar.startup(); 
                console.log("store"+JSON.stringify(calendar.get("store")));
            }

            );  
       </script>
    </head>
    <body class="claro">
      <div id="calDiv"> </div>
    </body>
    </html>

任何帮助!!

1 个答案:

答案 0 :(得分:1)

有几件事

  1. 商店分配应位于新的日历构造函数
  2. 数据对象应为数组
  3. 您必须导入Observable Class

     require([
    "dojox/calendar/Calendar",
    "dojo/store/Memory",
    "dojo/_base/Deferred",
    "dijit/_base/manager",
    "dojo/store/Observable"
    "dojo/domReady!"],
    
    function (Calendar, Memory, Deferred, manager, Observable) {
    mem = new Memory({
        data: [{
            "id": 1,
                "summary": "Daily Call",
                "startTime": new Date(2014, 2, 25, 9, 0),
                "endTime": new Date(2014, 2, 25, 11, 0)
        }]
    });
    console.log("mem is --->  " + JSON.stringify(mem));
    var calendar = new Calendar({
        dateInterval: "month",
        startTimeAttr: "startTime",
        endTimeAttr: "endTime",
        store: new Observable(mem)
    }, "calDiv");
    
    
    calendar.startup();
    }
    
    );
    

    小提琴:http://jsfiddle.net/theinnkeeper/ULX2w/