javascriptcalendardojodojox.calendar

Columns in a Day (Dojo Toolkit dojox.Calendar)


I have a problem with dojox.calendar features. Briefly, I am trying to place subcolumns into the calendar with "day" as dateInterval. I have read and tried the following link : 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"]);

my dummy code is here

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"
                }]
            }));
        )
    }

In the result, it shows me the subcolumns in a day, but I cannot place my events to those subcolumns The screenshot from dummy code How can I solve this issue?

Thank you for your helps and sorry for my English.


Solution

  • The date property to is set to 2007 whereas, your data was reflecting the date for 2016.

    Also Since you have changed the startTimeAttr and endTimeAttr. your data should reflect accordingly.

     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"
                                 }
                               ]}));
     )}