1 if(!dojo._hasResource["dojox.grid._grid.cell"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.grid._grid.cell"] = true;
3 dojo.provide("dojox.grid._grid.cell");
5 dojo.declare("dojox.grid.cell", null, {
7 // Respresents a grid cell and contains information about column options and methods
8 // for retrieving cell related information.
9 // Each column in a grid layout has a cell object and most events and many methods
10 // provide access to these objects.
12 constructor: function(inProps){
13 dojo.mixin(this, inProps);
14 if(this.editor){this.editor = new this.editor(this);}
17 format: function(inRowIndex){
19 // provides the html for a given grid cell.
22 // returns: html for a given grid cell
23 var f, i=this.grid.edit.info, d=this.get ? this.get(inRowIndex) : this.value;
24 if(this.editor && (this.editor.alwaysOn || (i.rowIndex==inRowIndex && i.cell==this))){
25 return this.editor.format(d, inRowIndex);
27 return (f = this.formatter) ? f.call(this, d, inRowIndex) : d;
31 getNode: function(inRowIndex){
33 // gets the dom node for a given grid cell.
36 // returns: dom node for a given grid cell
37 return this.view.getCellNode(inRowIndex, this.index);
40 var uw = this.unitWidth;
41 return uw && (uw=='auto' || uw.slice(-1)=='%');
44 applyEdit: function(inValue, inRowIndex){
45 this.grid.edit.applyCellEdit(inValue, this, inRowIndex);
47 cancelEdit: function(inRowIndex){
48 this.grid.doCancelEdit(inRowIndex);
50 _onEditBlur: function(inRowIndex){
51 if(this.grid.edit.isEditCell(inRowIndex, this.index)){
52 //console.log('editor onblur', e);
53 this.grid.edit.apply();
56 registerOnBlur: function(inNode, inRowIndex){
57 if(this.commitOnBlur){
58 dojo.connect(inNode, "onblur", function(e){
59 // hack: if editor still thinks this editor is current some ms after it blurs, assume we've focused away from grid
60 setTimeout(dojo.hitch(this, "_onEditBlur", inRowIndex), 250);