bella
bella

Reputation: 1

dojox calendar don't show events

I'm trying to work with dojox.Calendar to show events but it doesn't work

The calendar widget is populated with a list of data items using a store set on its store property. Here is the dojox.Calendar code

    <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>

any help !!

Upvotes: 0

Views: 454

Answers (1)

tik27
tik27

Reputation: 2698

There are a couple of things

  1. The store assignment should be within the new Calendar constructor
  2. The data object should be an array
  3. You have to import the 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();
    }
    
    );
    

    Fiddle:http://jsfiddle.net/theinnkeeper/ULX2w/

Upvotes: 1

Related Questions