dojox/grid/cells/_base.js

  • Provides:

    • dojox.grid.cells._base
  • Requires:

    • dojox.grid.util in common
    • dijit._Widget in common in project dijit
  • dojox.grid._DeferredTextWidget

    • type
      Function
    • chains:
      • dijit._Widget: (prototype)
      • dijit._Widget: (call)
    • summary
  • dojox.grid._DeferredTextWidget.deferred

    • summary
  • dojox.grid._DeferredTextWidget._destroyOnRemove

    • summary
  • dojox.grid._DeferredTextWidget.postCreate

    • type
      Function
    • source: [view]
        if(this.deferred){
         this.deferred.addBoth(dojo.hitch(this, function(text){
          if(this.domNode){
           this.domNode.innerHTML = text;
          }
         }));
        }
    • summary
  • dojox.grid._DeferredTextWidget.domNode.innerHTML

    • summary
  • dojox.grid.cells._Base

    • type
      Function
    • summary
      Respresents a grid cell and contains information about column options and methods
      for retrieving cell related information.
      Each column in a grid layout has a cell object and most events and many methods
      provide access to these objects.
    • parameters:
      • inProps: (typeof )
    • source: [view]
         this._props = inProps || {};
         dojo.mixin(this, inProps);
         if(this.draggable === undefined){
          this.draggable = true;
         }
  • dojox.grid.cells._Base.styles

    • summary
  • dojox.grid.cells._Base.classes

    • summary
  • dojox.grid.cells._Base.editable

    • summary
  • dojox.grid.cells._Base.alwaysEditing

    • summary
  • dojox.grid.cells._Base.formatter

    • summary
  • dojox.grid.cells._Base.defaultValue

    • summary
  • dojox.grid.cells._Base.value

    • summary
  • dojox.grid.cells._Base.hidden

    • summary
  • dojox.grid.cells._Base.noresize

    • summary
  • dojox.grid.cells._Base.draggable

    • summary
  • dojox.grid.cells._Base._valueProp

    • summary
  • dojox.grid.cells._Base._formatPending

    • summary
  • dojox.grid.cells._Base._defaultFormat

    • type
      Function
    • parameters:
      • inValue: (typeof )
      • callArgs: (typeof )
    • source: [view]
         var s = this.grid.formatterScope || this;
         var f = this.formatter;
         if(f && s && typeof f == "string"){
          f = this.formatter = s[f];
         }
         var v = (inValue != this.defaultValue && f) ? f.apply(s, callArgs) : inValue;
         if(typeof v == "undefined"){
          return this.defaultValue;
         }
         if(v && v.addBoth){
          // Check if it's a deferred
          v = new dojox.grid._DeferredTextWidget({deferred: v},
               dojo.create("span", {innerHTML: this.defaultValue}));
         }
         if(v && v.declaredClass && v.startup){
          return "
      " +
            this.defaultValue +
            "
      ";
         }
         return v;
    • summary
  • dojox.grid.cells._Base.format

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
      • inItem: (typeof )
    • source: [view]
         var f, i=this.grid.edit.info, d=this.get ? this.get(inRowIndex, inItem) : (this.value || this.defaultValue);
         d = (d && d.replace && this.grid.escapeHTMLInData) ? d.replace(/&/g, '&').replace(/   if(this.editable && (this.alwaysEditing || (i.rowIndex==inRowIndex && i.cell==this))){
          return this.formatEditing(d, inRowIndex);
         }else{
          return this._defaultFormat(d, [d, inRowIndex, this]);
         }
    • summary
      provides the html for a given grid cell.
    • return_summary
      html for a given grid cell
  • dojox.grid.cells._Base.formatEditing

    • type
      Function
    • parameters:
      • inDatum: (typeof anything)
        cell data to edit
      • inRowIndex: (typeof int)
        grid row index
    • source: [view]
         // summary:
         // formats the cell for editing
         // inDatum: anything
         // cell data to edit
         // inRowIndex: int
         // grid row index
         // returns: string of html to place in grid cell
    • summary
      formats the cell for editing
    • return_summary
      string of html to place in grid cell
  • dojox.grid.cells._Base.getNode

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
    • source: [view]
         return this.view.getCellNode(inRowIndex, this.index);
    • summary
      gets the dom node for a given grid cell.
    • return_summary
      dom node for a given grid cell
  • dojox.grid.cells._Base.getHeaderNode

    • type
      Function
    • source: [view]
         return this.view.getHeaderCellNode(this.index);
    • summary
  • dojox.grid.cells._Base.getEditNode

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
    • source: [view]
         return (this.getNode(inRowIndex) || 0).firstChild || 0;
    • summary
  • dojox.grid.cells._Base.canResize

    • type
      Function
    • source: [view]
         var uw = this.unitWidth;
         return uw && (uw!=='auto');
    • summary
  • dojox.grid.cells._Base.isFlex

    • type
      Function
    • source: [view]
         var uw = this.unitWidth;
         return uw && dojo.isString(uw) && (uw=='auto' || uw.slice(-1)=='%');
    • summary
  • dojox.grid.cells._Base.applyEdit

    • type
      Function
    • parameters:
      • inValue: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         this.grid.edit.applyCellEdit(inValue, this, inRowIndex);
    • summary
  • dojox.grid.cells._Base.cancelEdit

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
    • source: [view]
         this.grid.doCancelEdit(inRowIndex);
    • summary
  • dojox.grid.cells._Base._onEditBlur

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
    • source: [view]
         if(this.grid.edit.isEditCell(inRowIndex, this.index)){
          //console.log('editor onblur', e);
          this.grid.edit.apply();
         }
    • chains:
      • this.grid.edit: (call)
    • summary
  • dojox.grid.cells._Base.registerOnBlur

    • type
      Function
    • parameters:
      • inNode: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         if(this.commitOnBlur){
          dojo.connect(inNode, "onblur", function(e){
           // hack: if editor still thinks this editor is current some ms after it blurs, assume we've focused away from grid
           setTimeout(dojo.hitch(this, "_onEditBlur", inRowIndex), 250);
          });
         }
    • summary
  • dojox.grid.cells._Base.needFormatNode

    • type
      Function
    • parameters:
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         this._formatPending = true;
         whenIdle(this, "_formatNode", inDatum, inRowIndex);
    • summary
  • dojox.grid.cells._Base.cancelFormatNode

    • type
      Function
    • source: [view]
         this._formatPending = false;
    • summary
  • dojox.grid.cells._Base._formatNode

    • type
      Function
    • parameters:
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         if(this._formatPending){
          this._formatPending = false;
          // make cell selectable
          dojo.setSelectable(this.grid.domNode, true);
          this.formatNode(this.getEditNode(inRowIndex), inDatum, inRowIndex);
         }
    • summary
  • dojox.grid.cells._Base.formatNode

    • type
      Function
    • parameters:
      • inNode: (typeof dom)
        node
        dom node for the editor
      • inDatum: (typeof anything)
        cell data to edit
      • inRowIndex: (typeof int)
        grid row index
    • source: [view]
         if(dojo.isIE){
          // IE sux bad
          whenIdle(this, "focus", inRowIndex, inNode);
         }else{
          this.focus(inRowIndex, inNode);
         }
    • summary
      format the editing dom node. Use when editor is a widget.
  • dojox.grid.cells._Base.dispatchEvent

    • type
      Function
    • parameters:
      • m: (typeof )
      • e: (typeof )
    • source: [view]
         if(m in this){
          return this[m](e);
         }
    • summary
  • dojox.grid.cells._Base.getValue

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
    • source: [view]
         return this.getEditNode(inRowIndex)[this._valueProp];
    • summary
      returns value entered into editor
    • return_summary
      value of editor
  • dojox.grid.cells._Base.setValue

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
      • inValue: (typeof anything)
        value of editor
    • source: [view]
         var n = this.getEditNode(inRowIndex);
         if(n){
          n[this._valueProp] = inValue;
         }
    • summary
      set the value of the grid editor
  • dojox.grid.cells._Base.focus

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
      • inNode: (typeof dom)
        node
        editor node
    • source: [view]
         focusSelectNode(inNode || this.getEditNode(inRowIndex));
    • summary
      focus the grid editor
  • dojox.grid.cells._Base.save

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
    • source: [view]
         this.value = this.value || this.getValue(inRowIndex);
         //console.log("save", this.value, inCell.index, inRowIndex);
    • summary
      save editor state
  • dojox.grid.cells._Base.restore

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
    • source: [view]
         this.setValue(inRowIndex, this.value);
         //console.log("restore", this.value, inCell.index, inRowIndex);
    • summary
      restore editor state
  • dojox.grid.cells._Base._finish

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
    • source: [view]
         dojo.setSelectable(this.grid.domNode, false);
         this.cancelFormatNode();
    • summary
      called when editing is completed to clean up editor
  • dojox.grid.cells._Base.apply

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
    • source: [view]
         this.applyEdit(this.getValue(inRowIndex), inRowIndex);
         this._finish(inRowIndex);
    • summary
      apply edit from cell editor
  • dojox.grid.cells._Base.cancel

    • type
      Function
    • parameters:
      • inRowIndex: (typeof int)
        grid row index
    • source: [view]
         this.cancelEdit(inRowIndex);
         this._finish(inRowIndex);
    • summary
      cancel cell edit
  • dojox.grid.cells._Base._props

    • summary
  • dojox.grid.cells.Cell

    • type
      Function
    • chains:
      • dgc._Base: (prototype)
      • dgc._Base: (call)
    • source: [view]
         this.keyFilter = this.keyFilter;
    • summary
  • dojox.grid.cells.Cell.keyFilter

    • type
      RegExp
    • summary
      optional regex for disallowing keypresses
  • dojox.grid.cells.Cell.formatEditing

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

    • type
      Function
    • parameters:
      • inNode: (typeof )
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         this.inherited(arguments);
         // FIXME: feels too specific for this interface
         this.registerOnBlur(inNode, inRowIndex);
    • summary
  • dojox.grid.cells.Cell.doKey

    • type
      Function
    • parameters:
      • e: (typeof )
    • source: [view]
         if(this.keyFilter){
          var key = String.fromCharCode(e.charCode);
          if(key.search(this.keyFilter) == -1){
           dojo.stopEvent(e);
          }
         }
    • summary
  • dojox.grid.cells.Cell._finish

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
    • source: [view]
         this.inherited(arguments);
         var n = this.getEditNode(inRowIndex);
         try{
          dojox.grid.util.fire(n, "blur");
         }catch(e){}
    • summary
  • dojox.grid.cells.RowIndex

    • type
      Function
    • chains:
      • dgc.Cell: (prototype)
      • dgc.Cell: (call)
    • summary
  • dojox.grid.cells.RowIndex.name

    • summary
  • dojox.grid.cells.RowIndex.postscript

    • type
      Function
    • source: [view]
         this.editable = false;
    • summary
  • dojox.grid.cells.RowIndex.get

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
    • source: [view]
         return inRowIndex + 1;
    • summary
  • dojox.grid.cells.RowIndex.editable

    • summary
  • dojox.grid.cells.Select

    • type
      Function
    • chains:
      • dgc.Cell: (prototype)
      • dgc.Cell: (call)
    • summary
      grid cell that provides a standard select for editing
    • parameters:
      • inCell: (typeof )
    • source: [view]
         this.values = this.values || this.options;
  • dojox.grid.cells.Select.options

    • type
      Array
    • summary
      text of each item
  • dojox.grid.cells.Select.values

    • type
      Array
    • summary
      value for each item
  • dojox.grid.cells.Select.returnIndex

    • type
      Integer
    • summary
      editor returns only the index of the selected option and not the value
  • dojox.grid.cells.Select.formatEditing

    • type
      Function
    • parameters:
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         this.needFormatNode(inDatum, inRowIndex);
         var h = [ '');
         return h.join('');
    • summary
  • dojox.grid.cells.Select.getValue

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
    • source: [view]
         var n = this.getEditNode(inRowIndex);
         if(n){
          var i = n.selectedIndex, o = n.options[i];
          return this.returnIndex > -1 ? i : o.value || o.innerHTML;
         }
    • summary
  • dojox.grid.cells.AlwaysEdit

    • type
      Function
    • chains:
      • dgc.Cell: (prototype)
      • dgc.Cell: (call)
    • summary
      grid cell that is always in an editable state, regardless of grid editing state
  • dojox.grid.cells.AlwaysEdit.alwaysEditing

    • summary
  • dojox.grid.cells.AlwaysEdit._formatNode

    • type
      Function
    • parameters:
      • inDatum: (typeof )
      • inRowIndex: (typeof )
    • source: [view]
         this.formatNode(this.getEditNode(inRowIndex), inDatum, inRowIndex);
    • summary
  • dojox.grid.cells.AlwaysEdit.applyStaticValue

    • type
      Function
    • parameters:
      • inRowIndex: (typeof )
    • source: [view]
         var e = this.grid.edit;
         e.applyCellEdit(this.getValue(inRowIndex), this, inRowIndex);
         e.start(this, inRowIndex, true);
    • summary
  • dojox.grid.cells.Bool

    • type
      Function
    • chains:
      • dgc.AlwaysEdit: (prototype)
      • dgc.AlwaysEdit: (call)
    • summary
      grid cell that provides a standard checkbox that is always on for editing
  • dojox.grid.cells.Bool._valueProp

    • summary
  • dojox.grid.cells.Bool.formatEditing

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

    • type
      Function
    • parameters:
      • e: (typeof )
    • source: [view]
         if(e.target.tagName == 'INPUT'){
          this.applyStaticValue(e.rowIndex);
         }
    • summary
  • dojox.grid.cells._Base.markupFactory

    • type
      Function
    • parameters:
      • node: (typeof )
      • cellDef: (typeof )
    • source: [view]
        var d = dojo;
        var formatter = d.trim(d.attr(node, "formatter")||"");
        if(formatter){
         cellDef.formatter = dojo.getObject(formatter)||formatter;
        }
        var get = d.trim(d.attr(node, "get")||"");
        if(get){
         cellDef.get = dojo.getObject(get);
        }
        var getBoolAttr = function(attr, cell, cellAttr){
         var value = d.trim(d.attr(node, attr)||"");
         if(value){ cell[cellAttr||attr] = !(value.toLowerCase()=="false"); }
        };
        getBoolAttr("sortDesc", cellDef);
        getBoolAttr("editable", cellDef);
        getBoolAttr("alwaysEditing", cellDef);
        getBoolAttr("noresize", cellDef);
        getBoolAttr("draggable", cellDef);


        var value = d.trim(d.attr(node, "loadingText")||d.attr(node, "defaultValue")||"");
        if(value){
         cellDef.defaultValue = value;
        }


        var getStrAttr = function(attr, cell, cellAttr){
         var value = d.trim(d.attr(node, attr)||"")||undefined;
         if(value){ cell[cellAttr||attr] = value; }
        };
        getStrAttr("styles", cellDef);
        getStrAttr("headerStyles", cellDef);
        getStrAttr("cellStyles", cellDef);
        getStrAttr("classes", cellDef);
        getStrAttr("headerClasses", cellDef);
        getStrAttr("cellClasses", cellDef);
    • summary
  • dojox.grid.cells.Cell.markupFactory

    • type
      Function
    • parameters:
      • node: (typeof )
      • cellDef: (typeof )
    • source: [view]
        dgc._Base.markupFactory(node, cellDef);
        var d = dojo;
        var keyFilter = d.trim(d.attr(node, "keyFilter")||"");
        if(keyFilter){
         cellDef.keyFilter = new RegExp(keyFilter);
        }
    • summary
  • dojox.grid.cells.RowIndex.markupFactory

    • type
      Function
    • parameters:
      • node: (typeof )
      • cellDef: (typeof )
    • source: [view]
        dgc.Cell.markupFactory(node, cellDef);
    • summary
  • dojox.grid.cells.Select.markupFactory

    • type
      Function
    • parameters:
      • node: (typeof )
      • cell: (typeof )
    • source: [view]
        dgc.Cell.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;
         }
        }
        var values = d.trim(d.attr(node, "values")||"");
        if(values){
         var v = values.split(',');
         if(v[0] != values){
          cell.values = v;
         }
        }
    • summary
  • dojox.grid.cells.AlwaysEdit.markupFactory

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

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

    • type
      Object
    • summary
  • dojox.grid.cells

    • type
      Object
    • summary
  • dojox.grid

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary