2014-03-25 147 views
0

我試圖用dojox.Calendar合作,展示事件,但它不工作DojoX中日曆不顯示事件

日曆窗口小部件會填充上設置使用存儲數據項的列表其存儲財產。 這裏是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

有幾件事情

  1. 該店分配應該是新的日曆構造
  2. 內的數據對象應該是一個數組
  3. 你必須輸入可觀察的類

    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/

相關問題