Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 19th, 2012  |  syntax: None  |  size: 1.89 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. define(["dojo/_base/declare", "dijit/Calendar", "dojo/cldr/supplemental", "dojo/string", "dojo/dom"],
  2.     function(declare, Calendar, cldrSupplemental, string, dom){
  3.         return declare([Calendar], {
  4.  
  5.                         buildRendering: function(){
  6.                                 // Markup for days of the week (referenced from template)
  7.                                 var d = this.dowTemplateString,
  8.                                         dayNames = this.dateLocaleModule.getNames('days', this.dayWidth, 'standAlone', this.lang),
  9.                                         dayOffset = cldrSupplemental.getFirstDayOfWeek(this.lang);
  10.                                 this.dayCellsHtml = string.substitute([d,d,d,d,d,d,d].join(""), {d: ""}, function(){
  11.                                         return dayNames[dayOffset++ % 7]
  12.                                 });
  13.  
  14.                                 // Markup for dates of the month (referenced from template), but without numbers filled in
  15.                                 var r = string.substitute(this.weekTemplateString, {d: this.dateTemplateString});
  16.                                 this.dateRowsHtml = [r,r,r,r,r,r].join("");
  17.  
  18.                                 // Instantiate from template.
  19.                                 // dateCells and dateLabels arrays filled when _Templated parses my template.
  20.                                 this.dateCells = [];
  21.                                 this.dateLabels = [];
  22.                                 this.inherited(arguments);
  23.  
  24.                                 dom.setSelectable(this.domNode, false);
  25.  
  26.                                 var dateObj = new this.dateClassObj(this.currentFocus);
  27.  
  28.                                 this._supportingWidgets.push(this.monthWidget = this._createMonthWidget());
  29.  
  30.                                 this.set('currentFocus', dateObj, false);       // draw the grid to the month specified by currentFocus
  31.  
  32.                                 // Set up connects for increment/decrement of months/years
  33.                                 var connect = lang.hitch(this, function(nodeProp, part, amount){
  34.                                         this.connect(this[nodeProp], "onclick", function(){
  35.                                                 this._setCurrentFocusAttr(this.dateFuncObj.add(this.currentFocus, part, amount));
  36.                                         });
  37.                                 });
  38.                                 connect("incrementMonth", "month", 1);
  39.                                 connect("decrementMonth", "month", -1);
  40.                                 connect("nextYearLabelNode", "year", 1);
  41.                                 connect("previousYearLabelNode", "year", -1);
  42.                         },
  43.  
  44.                         postCreate: function(){
  45.                                 this.inherited(arguments);
  46.                         console.log(this);
  47.  
  48.                         }
  49.  
  50.         });
  51. });