diff options
Diffstat (limited to 'js/dojo-1.7.2/dojox/grid/cells')
| -rw-r--r-- | js/dojo-1.7.2/dojox/grid/cells/_base.js | 477 | ||||
| -rw-r--r-- | js/dojo-1.7.2/dojox/grid/cells/dijit.js | 256 | ||||
| -rw-r--r-- | js/dojo-1.7.2/dojox/grid/cells/tree.js | 75 |
3 files changed, 808 insertions, 0 deletions
diff --git a/js/dojo-1.7.2/dojox/grid/cells/_base.js b/js/dojo-1.7.2/dojox/grid/cells/_base.js new file mode 100644 index 0000000..a1731ef --- /dev/null +++ b/js/dojo-1.7.2/dojox/grid/cells/_base.js @@ -0,0 +1,477 @@ +//>>built +define("dojox/grid/cells/_base", [ + "dojo/_base/kernel", + "dojo/_base/declare", + "dojo/_base/lang", + "dojo/_base/event", + "dojo/_base/connect", + "dojo/_base/array", + "dojo/_base/sniff", + "dojo/dom", + "dojo/dom-attr", + "dojo/dom-construct", + "dijit/_Widget", + "../util" +], function(dojo, declare, lang, event, connect, array, has, dom, domAttr, domConstruct, _Widget, util){ + + var _DeferredTextWidget = declare("dojox.grid._DeferredTextWidget", _Widget, { + deferred: null, + _destroyOnRemove: true, + postCreate: function(){ + if(this.deferred){ + this.deferred.addBoth(lang.hitch(this, function(text){ + if(this.domNode){ + this.domNode.innerHTML = text; + } + })); + } + } + }); + + var focusSelectNode = function(inNode){ + try{ + util.fire(inNode, "focus"); + util.fire(inNode, "select"); + }catch(e){// IE sux bad + } + }; + + var whenIdle = function(/*inContext, inMethod, args ...*/){ + setTimeout(lang.hitch.apply(dojo, arguments), 0); + }; + + var BaseCell = declare("dojox.grid.cells._Base", null, { + // 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. + styles: '', + classes: '', + editable: false, + alwaysEditing: false, + formatter: null, + defaultValue: '...', + value: null, + hidden: false, + noresize: false, + draggable: true, + //private + _valueProp: "value", + _formatPending: false, + + constructor: function(inProps){ + this._props = inProps || {}; + lang.mixin(this, inProps); + if(this.draggable === undefined){ + this.draggable = true; + } + }, + + _defaultFormat: function(inValue, callArgs){ + 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 _DeferredTextWidget({deferred: v}, + domConstruct.create("span", {innerHTML: this.defaultValue})); + } + if(v && v.declaredClass && v.startup){ + return "<div class='dojoxGridStubNode' linkWidget='" + + v.id + + "' cellIdx='" + + this.index + + "'>" + + this.defaultValue + + "</div>"; + } + return v; + }, + + // data source + format: function(inRowIndex, inItem){ + // summary: + // provides the html for a given grid cell. + // inRowIndex: int + // grid row index + // returns: html for a given grid cell + 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(/</g, '<') : d; + if(this.editable && (this.alwaysEditing || (i.rowIndex==inRowIndex && i.cell==this))){ + return this.formatEditing(d, inRowIndex); + }else{ + return this._defaultFormat(d, [d, inRowIndex, this]); + } + }, + formatEditing: function(inDatum, inRowIndex){ + // 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 + }, + // utility + getNode: function(inRowIndex){ + // summary: + // gets the dom node for a given grid cell. + // inRowIndex: int + // grid row index + // returns: dom node for a given grid cell + return this.view.getCellNode(inRowIndex, this.index); + }, + getHeaderNode: function(){ + return this.view.getHeaderCellNode(this.index); + }, + getEditNode: function(inRowIndex){ + return (this.getNode(inRowIndex) || 0).firstChild || 0; + }, + canResize: function(){ + var uw = this.unitWidth; + return uw && (uw!=='auto'); + }, + isFlex: function(){ + var uw = this.unitWidth; + return uw && lang.isString(uw) && (uw=='auto' || uw.slice(-1)=='%'); + }, + // edit support + applyEdit: function(inValue, inRowIndex){ + this.grid.edit.applyCellEdit(inValue, this, inRowIndex); + }, + cancelEdit: function(inRowIndex){ + this.grid.doCancelEdit(inRowIndex); + }, + _onEditBlur: function(inRowIndex){ + if(this.grid.edit.isEditCell(inRowIndex, this.index)){ + //console.log('editor onblur', e); + this.grid.edit.apply(); + } + }, + registerOnBlur: function(inNode, inRowIndex){ + if(this.commitOnBlur){ + connect.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(lang.hitch(this, "_onEditBlur", inRowIndex), 250); + }); + } + }, + //protected + needFormatNode: function(inDatum, inRowIndex){ + this._formatPending = true; + whenIdle(this, "_formatNode", inDatum, inRowIndex); + }, + cancelFormatNode: function(){ + this._formatPending = false; + }, + //private + _formatNode: function(inDatum, inRowIndex){ + if(this._formatPending){ + this._formatPending = false; + // make cell selectable + if(!has("ie")){ + dom.setSelectable(this.grid.domNode, true); + } + this.formatNode(this.getEditNode(inRowIndex), inDatum, inRowIndex); + } + }, + //protected + formatNode: function(inNode, inDatum, inRowIndex){ + // summary: + // format the editing dom node. Use when editor is a widget. + // inNode: dom node + // dom node for the editor + // inDatum: anything + // cell data to edit + // inRowIndex: int + // grid row index + if(has("ie")){ + // IE sux bad + whenIdle(this, "focus", inRowIndex, inNode); + }else{ + this.focus(inRowIndex, inNode); + } + }, + dispatchEvent: function(m, e){ + if(m in this){ + return this[m](e); + } + }, + //public + getValue: function(inRowIndex){ + // summary: + // returns value entered into editor + // inRowIndex: int + // grid row index + // returns: + // value of editor + return this.getEditNode(inRowIndex)[this._valueProp]; + }, + setValue: function(inRowIndex, inValue){ + // summary: + // set the value of the grid editor + // inRowIndex: int + // grid row index + // inValue: anything + // value of editor + var n = this.getEditNode(inRowIndex); + if(n){ + n[this._valueProp] = inValue; + } + }, + focus: function(inRowIndex, inNode){ + // summary: + // focus the grid editor + // inRowIndex: int + // grid row index + // inNode: dom node + // editor node + focusSelectNode(inNode || this.getEditNode(inRowIndex)); + }, + save: function(inRowIndex){ + // summary: + // save editor state + // inRowIndex: int + // grid row index + this.value = this.value || this.getValue(inRowIndex); + //console.log("save", this.value, inCell.index, inRowIndex); + }, + restore: function(inRowIndex){ + // summary: + // restore editor state + // inRowIndex: int + // grid row index + this.setValue(inRowIndex, this.value); + //console.log("restore", this.value, inCell.index, inRowIndex); + }, + //protected + _finish: function(inRowIndex){ + // summary: + // called when editing is completed to clean up editor + // inRowIndex: int + // grid row index + dom.setSelectable(this.grid.domNode, false); + this.cancelFormatNode(); + }, + //public + apply: function(inRowIndex){ + // summary: + // apply edit from cell editor + // inRowIndex: int + // grid row index + this.applyEdit(this.getValue(inRowIndex), inRowIndex); + this._finish(inRowIndex); + }, + cancel: function(inRowIndex){ + // summary: + // cancel cell edit + // inRowIndex: int + // grid row index + this.cancelEdit(inRowIndex); + this._finish(inRowIndex); + } + }); + BaseCell.markupFactory = function(node, cellDef){ + var formatter = lang.trim(domAttr.get(node, "formatter")||""); + if(formatter){ + cellDef.formatter = lang.getObject(formatter)||formatter; + } + var get = lang.trim(domAttr.get(node, "get")||""); + if(get){ + cellDef.get = lang.getObject(get); + } + var getBoolAttr = function(attr, cell, cellAttr){ + var value = lang.trim(domAttr.get(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 = lang.trim(domAttr.get(node, "loadingText")||domAttr.get(node, "defaultValue")||""); + if(value){ + cellDef.defaultValue = value; + } + + var getStrAttr = function(attr, cell, cellAttr){ + var value = lang.trim(domAttr.get(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); + }; + + var Cell = declare("dojox.grid.cells.Cell", BaseCell, { + // summary + // grid cell that provides a standard text input box upon editing + constructor: function(){ + this.keyFilter = this.keyFilter; + }, + // keyFilter: RegExp + // optional regex for disallowing keypresses + keyFilter: null, + formatEditing: function(inDatum, inRowIndex){ + this.needFormatNode(inDatum, inRowIndex); + return '<input class="dojoxGridInput" type="text" value="' + inDatum + '">'; + }, + formatNode: function(inNode, inDatum, inRowIndex){ + this.inherited(arguments); + // FIXME: feels too specific for this interface + this.registerOnBlur(inNode, inRowIndex); + }, + doKey: function(e){ + if(this.keyFilter){ + var key = String.fromCharCode(e.charCode); + if(key.search(this.keyFilter) == -1){ + event.stop(e); + } + } + }, + _finish: function(inRowIndex){ + this.inherited(arguments); + var n = this.getEditNode(inRowIndex); + try{ + util.fire(n, "blur"); + }catch(e){} + } + }); + Cell.markupFactory = function(node, cellDef){ + BaseCell.markupFactory(node, cellDef); + var keyFilter = lang.trim(domAttr.get(node, "keyFilter")||""); + if(keyFilter){ + cellDef.keyFilter = new RegExp(keyFilter); + } + }; + + var RowIndex = declare("dojox.grid.cells.RowIndex", Cell, { + name: 'Row', + + postscript: function(){ + this.editable = false; + }, + get: function(inRowIndex){ + return inRowIndex + 1; + } + }); + RowIndex.markupFactory = function(node, cellDef){ + Cell.markupFactory(node, cellDef); + }; + + var Select = declare("dojox.grid.cells.Select", Cell, { + // summary: + // grid cell that provides a standard select for editing + + // options: Array + // text of each item + options: null, + + // values: Array + // value for each item + values: null, + + // returnIndex: Integer + // editor returns only the index of the selected option and not the value + returnIndex: -1, + + constructor: function(inCell){ + this.values = this.values || this.options; + }, + formatEditing: function(inDatum, inRowIndex){ + this.needFormatNode(inDatum, inRowIndex); + var h = [ '<select class="dojoxGridSelect">' ]; + for (var i=0, o, v; ((o=this.options[i]) !== undefined)&&((v=this.values[i]) !== undefined); i++){ + v = v.replace ? v.replace(/&/g, '&').replace(/</g, '<') : v; + o = o.replace ? o.replace(/&/g, '&').replace(/</g, '<') : o; + h.push("<option", (inDatum==v ? ' selected' : ''), ' value="' + v + '"', ">", o, "</option>"); + } + h.push('</select>'); + return h.join(''); + }, + _defaultFormat: function(inValue, callArgs){ + var v = this.inherited(arguments); + // when 'values' and 'options' both provided and there is no cutomized formatter, + // then we use 'options' as label in order to be consistent + if(!this.formatter && this.values && this.options){ + var i = array.indexOf(this.values, v); + if(i >= 0){ + v = this.options[i]; + } + } + return v; + }, + getValue: function(inRowIndex){ + var n = this.getEditNode(inRowIndex); + if(n){ + var i = n.selectedIndex, o = n.options[i]; + return this.returnIndex > -1 ? i : o.value || o.innerHTML; + } + } + }); + Select.markupFactory = function(node, cell){ + Cell.markupFactory(node, cell); + var options = lang.trim(domAttr.get(node, "options")||""); + if(options){ + var o = options.split(','); + if(o[0] != options){ + cell.options = o; + } + } + var values = lang.trim(domAttr.get(node, "values")||""); + if(values){ + var v = values.split(','); + if(v[0] != values){ + cell.values = v; + } + } + }; + + var AlwaysEdit = declare("dojox.grid.cells.AlwaysEdit", Cell, { + // summary: + // grid cell that is always in an editable state, regardless of grid editing state + alwaysEditing: true, + _formatNode: function(inDatum, inRowIndex){ + this.formatNode(this.getEditNode(inRowIndex), inDatum, inRowIndex); + }, + applyStaticValue: function(inRowIndex){ + var e = this.grid.edit; + e.applyCellEdit(this.getValue(inRowIndex), this, inRowIndex); + e.start(this, inRowIndex, true); + } + }); + AlwaysEdit.markupFactory = function(node, cell){ + Cell.markupFactory(node, cell); + }; + + var Bool = declare("dojox.grid.cells.Bool", AlwaysEdit, { + // summary: + // grid cell that provides a standard checkbox that is always on for editing + _valueProp: "checked", + formatEditing: function(inDatum, inRowIndex){ + return '<input class="dojoxGridInput" type="checkbox"' + (inDatum ? ' checked="checked"' : '') + ' style="width: auto" />'; + }, + doclick: function(e){ + if(e.target.tagName == 'INPUT'){ + this.applyStaticValue(e.rowIndex); + } + } + }); + Bool.markupFactory = function(node, cell){ + AlwaysEdit.markupFactory(node, cell); + }; + + return BaseCell; + +});
\ No newline at end of file diff --git a/js/dojo-1.7.2/dojox/grid/cells/dijit.js b/js/dojo-1.7.2/dojox/grid/cells/dijit.js new file mode 100644 index 0000000..502c4d2 --- /dev/null +++ b/js/dojo-1.7.2/dojox/grid/cells/dijit.js @@ -0,0 +1,256 @@ +//>>built +define("dojox/grid/cells/dijit", [ + "dojo/_base/kernel", + "../../main", + "dojo/_base/declare", + "dojo/_base/array", + "dojo/_base/lang", + "dojo/_base/json", + "dojo/_base/connect", + "dojo/_base/sniff", + "dojo/dom", + "dojo/dom-attr", + "dojo/dom-construct", + "dojo/dom-geometry", + "dojo/data/ItemFileReadStore", + "dijit/form/DateTextBox", + "dijit/form/TimeTextBox", + "dijit/form/ComboBox", + "dijit/form/CheckBox", + "dijit/form/TextBox", + "dijit/form/NumberSpinner", + "dijit/form/NumberTextBox", + "dijit/form/CurrencyTextBox", + "dijit/form/HorizontalSlider", + "dijit/Editor", + "../util", + "./_base" +], function(dojo, dojox, declare, array, lang, json, connect, has, dom, domAttr, domConstruct, + domGeometry, ItemFileReadStore, DateTextBox, TimeTextBox, ComboBox, CheckBox, TextBox, + NumberSpinner, NumberTextBox, CurrencyTextBox, HorizontalSlider, Editor, util, BaseCell){ + +// 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. + + var _Widget = declare("dojox.grid.cells._Widget", BaseCell, { + widgetClass: 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 = lang.getObject(this.widgetClass); + } + }, + formatEditing: function(inDatum, inRowIndex){ + this.needFormatNode(inDatum, inRowIndex); + return "<div></div>"; + }, + getValue: function(inRowIndex){ + return this.widget.get('value'); + }, + _unescapeHTML: function(value){ + return (value && value.replace && this.grid.escapeHTMLInData) ? + value.replace(/</g, '<').replace(/&/g, '&') : value; + }, + setValue: function(inRowIndex, inValue){ + if(this.widget&&this.widget.set){ + inValue = this._unescapeHTML(inValue); + //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 lang.mixin( + { + dir: this.dir, + lang: this.lang + }, + this.widgetProps||{}, + { + constraints: lang.mixin({}, this.constraint) || {}, //TODO: really just for ValidationTextBoxes + value: this._unescapeHTML(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(lang.hitch(this.widget, function(){ + util.fire(this, "focus"); + }), 0); + } + }, + _finish: function(inRowIndex){ + this.inherited(arguments); + util.removeNode(this.widget.domNode); + if(has("ie")){ + dom.setSelectable(this.widget.domNode, true); + } + } + }); + _Widget.markupFactory = function(node, cell){ + BaseCell.markupFactory(node, cell); + var widgetProps = lang.trim(domAttr.get(node, "widgetProps")||""); + var constraint = lang.trim(domAttr.get(node, "constraint")||""); + var widgetClass = lang.trim(domAttr.get(node, "widgetClass")||""); + if(widgetProps){ + cell.widgetProps = json.fromJson(widgetProps); + } + if(constraint){ + cell.constraint = json.fromJson(constraint); + } + if(widgetClass){ + cell.widgetClass = lang.getObject(widgetClass); + } + }; + + var ComboBox = declare("dojox.grid.cells.ComboBox", _Widget, { + widgetClass: ComboBox, + getWidgetProps: function(inDatum){ + var items=[]; + array.forEach(this.options, function(o){ + items.push({name: o, value: o}); + }); + var store = new ItemFileReadStore({data: {identifier:"name", items: items}}); + return lang.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'); + } + }); + ComboBox.markupFactory = function(node, cell){ + _Widget.markupFactory(node, cell); + var options = lang.trim(domAttr.get(node, "options")||""); + if(options){ + var o = options.split(','); + if(o[0] != options){ + cell.options = o; + } + } + }; + + var DateTextBox = declare("dojox.grid.cells.DateTextBox", _Widget, { + widgetClass: DateTextBox, + setValue: function(inRowIndex, inValue){ + if(this.widget){ + this.widget.set('value', new Date(inValue)); + }else{ + this.inherited(arguments); + } + }, + getWidgetProps: function(inDatum){ + return lang.mixin(this.inherited(arguments), { + value: new Date(inDatum) + }); + } + }); + DateTextBox.markupFactory = function(node, cell){ + _Widget.markupFactory(node, cell); + }; + + var CheckBox = declare("dojox.grid.cells.CheckBox", _Widget, { + widgetClass: 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; + } + }); + CheckBox.markupFactory = function(node, cell){ + _Widget.markupFactory(node, cell); + }; + + var Editor = declare("dojox.grid.cells.Editor", _Widget, { + widgetClass: Editor, + getWidgetProps: function(inDatum){ + return lang.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); + connect.connect(widget, 'onLoad', lang.hitch(this, 'populateEditor')); + return widget; + }, + formatNode: function(inNode, inDatum, inRowIndex){ + this.content = inDatum; + this.inherited(arguments); + if(has("mozilla")){ + // FIXME: seem to need to reopen the editor and display the toolbar + var e = this.widget; + e.open(); + if(this.widgetToolbar){ + domConstruct.place(e.toolbar.domNode, e.editingArea, "before"); + } + } + }, + populateEditor: function(){ + this.widget.set('value', this.content); + this.widget.placeCursorAtEnd(); + } + }); + Editor.markupFactory = function(node, cell){ + _Widget.markupFactory(node, cell); + var h = lang.trim(domAttr.get(node, "widgetHeight")||""); + if(h){ + if((h != "auto")&&(h.substr(-2) != "em")){ + h = parseInt(h, 10)+"px"; + } + cell.widgetHeight = h; + } + }; + + return dojox.grid.cells.dijit; + +});
\ No newline at end of file diff --git a/js/dojo-1.7.2/dojox/grid/cells/tree.js b/js/dojo-1.7.2/dojox/grid/cells/tree.js new file mode 100644 index 0000000..7974a8a --- /dev/null +++ b/js/dojo-1.7.2/dojox/grid/cells/tree.js @@ -0,0 +1,75 @@ +//>>built +define("dojox/grid/cells/tree", [ + "dojo/_base/kernel", + "../../main", + "dojo/_base/lang", + "../cells" +], function(dojo, dojox, lang){ + +dojox.grid.cells.TreeCell = { + formatAggregate: function(inItem, level, inRowIndexes){ + var f, g=this.grid, i=g.edit.info, + d=g.aggregator ? g.aggregator.getForCell(this, level, inItem, level === this.level ? "cnt" : this.parentCell.aggregate) : (this.value || this.defaultValue); + return this._defaultFormat(d, [d, level - this.level, inRowIndexes, this]); + }, + formatIndexes: function(inRowIndexes, inItem){ + var f, g=this.grid, i=g.edit.info, + d=this.get ? this.get(inRowIndexes[0], inItem, inRowIndexes) : (this.value || this.defaultValue); + if(this.editable && (this.alwaysEditing || (i.rowIndex==inRowIndexes[0] && i.cell==this))){ + return this.formatEditing(d, inRowIndexes[0], inRowIndexes); + }else{ + return this._defaultFormat(d, [d, inRowIndexes[0], inRowIndexes, this]); + } + }, + getOpenState: function(itemId){ + var grid = this.grid, store = grid.store, itm = null; + if(store.isItem(itemId)){ + itm = itemId; + itemId = store.getIdentity(itemId); + } + if(!this.openStates){ this.openStates = {}; } + if(typeof itemId != "string" || !(itemId in this.openStates)){ + this.openStates[itemId] = grid.getDefaultOpenState(this, itm); + } + return this.openStates[itemId]; + }, + formatAtLevel: function(inRowIndexes, inItem, level, summaryRow, toggleClass, cellClasses){ + if(!lang.isArray(inRowIndexes)){ + inRowIndexes = [inRowIndexes]; + } + var result = ""; + if(level > this.level || (level === this.level && summaryRow)){ + cellClasses.push("dojoxGridSpacerCell"); + if(level === this.level){ + cellClasses.push("dojoxGridTotalCell"); + } + result = '<span></span>'; + }else if(level < this.level){ + cellClasses.push("dojoxGridSummaryCell"); + result = '<span class="dojoxGridSummarySpan">' + this.formatAggregate(inItem, level, inRowIndexes) + '</span>'; + }else{ + var ret = ""; + if(this.isCollapsable){ + var store = this.grid.store, id = ""; + if(store.isItem(inItem)){ + id = store.getIdentity(inItem); + } + cellClasses.push("dojoxGridExpandoCell"); + ret = '<span ' + dojo._scopeName + 'Type="dojox.grid._Expando" level="' + level + '" class="dojoxGridExpando"' + + '" toggleClass="' + toggleClass + '" itemId="' + id + '" cellIdx="' + this.index + '"></span>'; + } + result = ret + this.formatIndexes(inRowIndexes, inItem); + } + + if(this.grid.focus.cell && this.index == this.grid.focus.cell.index && + inRowIndexes.join('/') == this.grid.focus.rowIndex){ + cellClasses.push(this.grid.focus.focusClass); + } + + return result; + } +}; + +return dojox.grid.cells.TreeCell; + +});
\ No newline at end of file |
