dojox/grid/cells/dijit.js

  • Provides:

    • dojox.grid.cells.dijit
  • Requires:

    • dojox.grid.cells in common
    • dijit.form.DateTextBox in common in project dijit
    • dijit.form.TimeTextBox in common in project dijit
    • dijit.form.ComboBox in common in project dijit
    • dojo.data.ItemFileReadStore in common in project dojo
    • dijit.form.CheckBox in common in project dijit
    • dijit.form.TextBox in common in project dijit
    • dijit.form.NumberSpinner in common in project dijit
    • dijit.form.NumberTextBox in common in project dijit
    • dijit.form.CurrencyTextBox in common in project dijit
    • dijit.form.HorizontalSlider in common in project dijit
    • dijit.Editor in common in project dijit
  • dojox.grid.cells._Widget

    • type
      Function
    • chains:
      • dgc._Base: (prototype)
      • dgc._Base: (call)
    • parameters:
      • inCell: (typeof )
    • source: [view]
         this.widget = null;
         if(typeof this.widgetClass == "string"){
          dojo.deprecated("Passing a string to widgetClass is deprecated", "pass the widget class object instead", "2.0");
          this.widgetClass = dojo.getObject(this.widgetClass);
         }
    • summary
  • dojox.grid.cells._Widget.widgetClass

    • summary
  • dojox.grid.cells._Widget.formatEditing

    • type
      Function
    • parameters:
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         this.needFormatNode(inDatum, inRowIndex);
         return "
      ";
    • summary
  • dojox.grid.cells._Widget.getValue

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
    • source: [view]
         return this.widget.get('value');
    • summary
  • dojox.grid.cells._Widget.setValue

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
      • inValue: (typeof )
    • source: [view]
         if(this.widget&&this.widget.set){
          //Look for lazy-loading editor and handle it via its deferred.
          if(this.widget.onLoadDeferred){
           var self = this;
           this.widget.onLoadDeferred.addCallback(function(){
            self.widget.set("value",inValue===null?"":inValue);
           });
          }else{
           this.widget.set("value", inValue);
          }
         }else{
          this.inherited(arguments);
         }
    • summary
  • dojox.grid.cells._Widget.getWidgetProps

    • type
      Function
    • parameters:
      • inDatum: (typeof )
    • source: [view]
         return dojo.mixin(
          {
           dir: this.dir,
           lang: this.lang
          },
          this.widgetProps||{},
          {
           constraints: dojo.mixin({}, this.constraint) || {}, //TODO: really just for ValidationTextBoxes
           value: inDatum
          }
         );
    • summary
  • dojox.grid.cells._Widget.createWidget

    • type
      Function
    • parameters:
      • inNode: (typeof )
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         return new this.widgetClass(this.getWidgetProps(inDatum), inNode);
    • summary
  • dojox.grid.cells._Widget.attachWidget

    • type
      Function
    • parameters:
      • inNode: (typeof )
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         inNode.appendChild(this.widget.domNode);
         this.setValue(inRowIndex, inDatum);
    • summary
  • dojox.grid.cells._Widget.formatNode

    • type
      Function
    • parameters:
      • inNode: (typeof )
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         if(!this.widgetClass){
          return inDatum;
         }
         if(!this.widget){
          this.widget = this.createWidget.apply(this, arguments);
         }else{
          this.attachWidget.apply(this, arguments);
         }
         this.sizeWidget.apply(this, arguments);
         this.grid.views.renormalizeRow(inRowIndex);
         this.grid.scroller.rowHeightChanged(inRowIndex, true/*fix #11101*/);
         this.focus();
         return undefined;
    • chains:
      • this.createWidget: (call)
      • this.attachWidget: (call)
      • this.sizeWidget: (call)
    • summary
  • dojox.grid.cells._Widget.sizeWidget

    • type
      Function
    • parameters:
      • inNode: (typeof )
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         var
          p = this.getNode(inRowIndex),
          box = dojo.contentBox(p);
         dojo.marginBox(this.widget.domNode, {w: box.w});
    • summary
  • dojox.grid.cells._Widget.focus

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
      • inNode: (typeof )
    • source: [view]
         if(this.widget){
          setTimeout(dojo.hitch(this.widget, function(){
           dojox.grid.util.fire(this, "focus");
          }), 0);
         }
    • summary
  • dojox.grid.cells._Widget._finish

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
    • source: [view]
         this.inherited(arguments);
         dojox.grid.util.removeNode(this.widget.domNode);
         if(dojo.isIE){
          dojo.setSelectable(this.widget.domNode, true);
         }
    • summary
  • dojox.grid.cells._Widget.widget

    • summary
  • dojox.grid.cells.ComboBox

    • type
      Function
    • chains:
      • dgc._Widget: (prototype)
      • dgc._Widget: (call)
    • summary
  • dojox.grid.cells.ComboBox.widgetClass

    • summary
  • dojox.grid.cells.ComboBox.getWidgetProps

    • type
      Function
    • parameters:
      • inDatum: (typeof )
    • source: [view]
         var items=[];
         dojo.forEach(this.options, function(o){
          items.push({name: o, value: o});
         });
         var store = new dojo.data.ItemFileReadStore({data: {identifier:"name", items: items}});
         return dojo.mixin({}, this.widgetProps||{}, {
          value: inDatum,
          store: store
         });
    • summary
  • dojox.grid.cells.ComboBox.getValue

    • type
      Function
    • source: [view]
         var e = this.widget;
         // make sure to apply the displayed value
         e.set('displayedValue', e.get('displayedValue'));
         return e.get('value');
    • summary
  • dojox.grid.cells.DateTextBox

    • type
      Function
    • chains:
      • dgc._Widget: (prototype)
      • dgc._Widget: (call)
    • summary
  • dojox.grid.cells.DateTextBox.widgetClass

    • summary
  • dojox.grid.cells.DateTextBox.setValue

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
      • inValue: (typeof )
    • source: [view]
         if(this.widget){
          this.widget.set('value', new Date(inValue));
         }else{
          this.inherited(arguments);
         }
    • summary
  • dojox.grid.cells.DateTextBox.getWidgetProps

    • type
      Function
    • parameters:
      • inDatum: (typeof )
    • source: [view]
         return dojo.mixin(this.inherited(arguments), {
          value: new Date(inDatum)
         });
    • summary
  • dojox.grid.cells.CheckBox

    • type
      Function
    • chains:
      • dgc._Widget: (prototype)
      • dgc._Widget: (call)
    • summary
  • dojox.grid.cells.CheckBox.widgetClass

    • summary
  • dojox.grid.cells.CheckBox.getValue

    • type
      Function
    • source: [view]
         return this.widget.checked;
    • summary
  • dojox.grid.cells.CheckBox.setValue

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
      • inValue: (typeof )
    • source: [view]
         if(this.widget&&this.widget.attributeMap.checked){
          this.widget.set("checked", inValue);
         }else{
          this.inherited(arguments);
         }
    • summary
  • dojox.grid.cells.CheckBox.sizeWidget

    • type
      Function
    • parameters:
      • inNode: (typeof )
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         return;
    • summary
  • dojox.grid.cells.Editor

    • type
      Function
    • chains:
      • dgc._Widget: (prototype)
      • dgc._Widget: (call)
    • summary
  • dojox.grid.cells.Editor.widgetClass

    • summary
  • dojox.grid.cells.Editor.getWidgetProps

    • type
      Function
    • parameters:
      • inDatum: (typeof )
    • source: [view]
         return dojo.mixin({}, this.widgetProps||{}, {
          height: this.widgetHeight || "100px"
         });
    • summary
  • dojox.grid.cells.Editor.createWidget

    • type
      Function
    • parameters:
      • inNode: (typeof )
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
      dojo.provide("dojox.grid.cells.dijit");


      dojo.require("dojox.grid.cells");


      // TODO: shouldn't it be the test file's job to require these modules,
      // if it is using them? Most of these modules aren't referenced by this file.


      dojo.require("dijit.form.DateTextBox");
      dojo.require("dijit.form.TimeTextBox");
      dojo.require("dijit.form.ComboBox");
      dojo.require("dojo.data.ItemFileReadStore");
      dojo.require("dijit.form.CheckBox");
      dojo.require("dijit.form.TextBox");
      dojo.require("dijit.form.NumberSpinner");
      dojo.require("dijit.form.NumberTextBox");
      dojo.require("dijit.form.CurrencyTextBox");
      dojo.require("dijit.form.HorizontalSlider");
      dojo.require("dijit.Editor");


      (function(){
       var dgc = dojox.grid.cells;
       dojo.declare("dojox.grid.cells._Widget", dgc._Base, {
        widgetClass: dijit.form.TextBox,
        constructor: function(inCell){
         this.widget = null;
         if(typeof this.widgetClass == "string"){
          dojo.deprecated("Passing a string to widgetClass is deprecated", "pass the widget class object instead", "2.0");
          this.widgetClass = dojo.getObject(this.widgetClass);
         }
        },
        formatEditing: function(inDatum, inRowIndex){
         this.needFormatNode(inDatum, inRowIndex);
         return "
      ";
        },
        getValue: function(inRowIndex){
         return this.widget.get('value');
        },
        setValue: function(inRowIndex, inValue){
         if(this.widget&&this.widget.set){
          //Look for lazy-loading editor and handle it via its deferred.
          if(this.widget.onLoadDeferred){
           var self = this;
           this.widget.onLoadDeferred.addCallback(function(){
            self.widget.set("value",inValue===null?"":inValue);
           });
          }else{
           this.widget.set("value", inValue);
          }
         }else{
          this.inherited(arguments);
         }
        },
        getWidgetProps: function(inDatum){
         return dojo.mixin(
          {
           dir: this.dir,
           lang: this.lang
          },
          this.widgetProps||{},
          {
           constraints: dojo.mixin({}, this.constraint) || {}, //TODO: really just for ValidationTextBoxes
           value: inDatum
          }
         );
        },
        createWidget: function(inNode, inDatum, inRowIndex){
         return new this.widgetClass(this.getWidgetProps(inDatum), inNode);
        },
        attachWidget: function(inNode, inDatum, inRowIndex){
         inNode.appendChild(this.widget.domNode);
         this.setValue(inRowIndex, inDatum);
        },
        formatNode: function(inNode, inDatum, inRowIndex){
         if(!this.widgetClass){
          return inDatum;
         }
         if(!this.widget){
          this.widget = this.createWidget.apply(this, arguments);
         }else{
          this.attachWidget.apply(this, arguments);
         }
         this.sizeWidget.apply(this, arguments);
         this.grid.views.renormalizeRow(inRowIndex);
         this.grid.scroller.rowHeightChanged(inRowIndex, true/*fix #11101*/);
         this.focus();
         return undefined;
        },
        sizeWidget: function(inNode, inDatum, inRowIndex){
         var
          p = this.getNode(inRowIndex),
          box = dojo.contentBox(p);
         dojo.marginBox(this.widget.domNode, {w: box.w});
        },
        focus: function(inRowIndex, inNode){
         if(this.widget){
          setTimeout(dojo.hitch(this.widget, function(){
           dojox.grid.util.fire(this, "focus");
          }), 0);
         }
        },
        _finish: function(inRowIndex){
         this.inherited(arguments);
         dojox.grid.util.removeNode(this.widget.domNode);
         if(dojo.isIE){
          dojo.setSelectable(this.widget.domNode, true);
         }
        }
       });
       dgc._Widget.markupFactory = function(node, cell){
        dgc._Base.markupFactory(node, cell);
        var d = dojo;
        var widgetProps = d.trim(d.attr(node, "widgetProps")||"");
        var constraint = d.trim(d.attr(node, "constraint")||"");
        var widgetClass = d.trim(d.attr(node, "widgetClass")||"");
        if(widgetProps){
         cell.widgetProps = d.fromJson(widgetProps);
        }
        if(constraint){
         cell.constraint = d.fromJson(constraint);
        }
        if(widgetClass){
         cell.widgetClass = d.getObject(widgetClass);
        }
       };


       dojo.declare("dojox.grid.cells.ComboBox", dgc._Widget, {
        widgetClass: dijit.form.ComboBox,
        getWidgetProps: function(inDatum){
         var items=[];
         dojo.forEach(this.options, function(o){
          items.push({name: o, value: o});
         });
         var store = new dojo.data.ItemFileReadStore({data: {identifier:"name", items: items}});
         return dojo.mixin({}, this.widgetProps||{}, {
          value: inDatum,
          store: store
         });
        },
        getValue: function(){
         var e = this.widget;
         // make sure to apply the displayed value
         e.set('displayedValue', e.get('displayedValue'));
         return e.get('value');
        }
       });
       dgc.ComboBox.markupFactory = function(node, cell){
        dgc._Widget.markupFactory(node, cell);
        var d=dojo;
        var options = d.trim(d.attr(node, "options")||"");
        if(options){
         var o = options.split(',');
         if(o[0] != options){
          cell.options = o;
         }
        }
       };


       dojo.declare("dojox.grid.cells.DateTextBox", dgc._Widget, {
        widgetClass: dijit.form.DateTextBox,
        setValue: function(inRowIndex, inValue){
         if(this.widget){
          this.widget.set('value', new Date(inValue));
         }else{
          this.inherited(arguments);
         }
        },
        getWidgetProps: function(inDatum){
         return dojo.mixin(this.inherited(arguments), {
          value: new Date(inDatum)
         });
        }
       });
       dgc.DateTextBox.markupFactory = function(node, cell){
        dgc._Widget.markupFactory(node, cell);
       };


       dojo.declare("dojox.grid.cells.CheckBox", dgc._Widget, {
        widgetClass: dijit.form.CheckBox,
        getValue: function(){
         return this.widget.checked;
        },
        setValue: function(inRowIndex, inValue){
         if(this.widget&&this.widget.attributeMap.checked){
          this.widget.set("checked", inValue);
         }else{
          this.inherited(arguments);
         }
        },
        sizeWidget: function(inNode, inDatum, inRowIndex){
         return;
        }
       });
       dgc.CheckBox.markupFactory = function(node, cell){
        dgc._Widget.markupFactory(node, cell);
       };


       dojo.declare("dojox.grid.cells.Editor", dgc._Widget, {
        widgetClass: dijit.Editor,
        getWidgetProps: function(inDatum){
         return dojo.mixin({}, this.widgetProps||{}, {
          height: this.widgetHeight || "100px"
         });
        },
        createWidget: function(inNode, inDatum, inRowIndex){
         // widget needs its value set after creation
         var widget = new this.widgetClass(this.getWidgetProps(inDatum), inNode);
         dojo.connect(widget, 'onLoad', dojo.hitch(this, 'populateEditor'));
         return widget;
    • summary
  • dojox.grid.cells.Editor.formatNode

    • type
      Function
    • parameters:
      • inNode: (typeof )
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         this.content = inDatum;
         this.inherited(arguments);
         if(dojo.isMoz){
          // FIXME: seem to need to reopen the editor and display the toolbar
          var e = this.widget;
          e.open();
          if(this.widgetToolbar){
           dojo.place(e.toolbar.domNode, e.editingArea, "before");
          }
         }
    • summary
  • dojox.grid.cells.Editor.populateEditor

    • type
      Function
    • source: [view]
         this.widget.set('value', this.content);
         this.widget.placeCursorAtEnd();
    • summary
  • dojox.grid.cells.Editor.content

    • summary
  • dojox.grid.cells._Widget.markupFactory

    • type
      Function
    • parameters:
      • node: (typeof )
      • cell: (typeof )
    • source: [view]
        dgc._Base.markupFactory(node, cell);
        var d = dojo;
        var widgetProps = d.trim(d.attr(node, "widgetProps")||"");
        var constraint = d.trim(d.attr(node, "constraint")||"");
        var widgetClass = d.trim(d.attr(node, "widgetClass")||"");
        if(widgetProps){
         cell.widgetProps = d.fromJson(widgetProps);
        }
        if(constraint){
         cell.constraint = d.fromJson(constraint);
        }
        if(widgetClass){
         cell.widgetClass = d.getObject(widgetClass);
        }
    • summary
  • dojox.grid.cells.ComboBox.markupFactory

    • type
      Function
    • parameters:
      • node: (typeof )
      • cell: (typeof )
    • source: [view]
        dgc._Widget.markupFactory(node, cell);
        var d=dojo;
        var options = d.trim(d.attr(node, "options")||"");
        if(options){
         var o = options.split(',');
         if(o[0] != options){
          cell.options = o;
         }
        }
    • summary
  • dojox.grid.cells.DateTextBox.markupFactory

    • type
      Function
    • parameters:
      • node: (typeof )
      • cell: (typeof )
    • source: [view]
        dgc._Widget.markupFactory(node, cell);
    • summary
  • dojox.grid.cells.CheckBox.markupFactory

    • type
      Function
    • parameters:
      • node: (typeof )
      • cell: (typeof )
    • source: [view]
        dgc._Widget.markupFactory(node, cell);
    • summary
  • dojox.grid.cells.Editor.markupFactory

    • type
      Function
    • parameters:
      • node: (typeof )
      • cell: (typeof )
    • source: [view]
        dgc._Widget.markupFactory(node, cell);
        var d = dojo;
        var h = dojo.trim(dojo.attr(node, "widgetHeight")||"");
        if(h){
         if((h != "auto")&&(h.substr(-2) != "em")){
          h = parseInt(h, 10)+"px";
         }
         cell.widgetHeight = h;
        }
    • summary
  • dojox.grid.cells.dijit

    • type
      Object
    • summary
  • dojox.grid.cells

    • type
      Object
    • summary
  • dojox.grid

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary