root / trunk / web / dojo / dojox / grid / cells / tree.js @ 10
History | View | Annotate | Download (2.11 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.grid.cells.tree"]){ |
||
9 | dojo._hasResource["dojox.grid.cells.tree"]=true; |
||
10 | dojo.provide("dojox.grid.cells.tree");
|
||
11 | dojo.require("dojox.grid.cells");
|
||
12 | dojox.grid.cells.TreeCell={formatAggregate:function(_1,_2,_3){ |
||
13 | var f,g=this.grid,i=g.edit.info,d=g.aggregator?g.aggregator.getForCell(this,_2,_1,_2===this.level?"cnt":this.parentCell.aggregate):(this.value||this.defaultValue); |
||
14 | return this._defaultFormat(d,[d,_2-this.level,_3,this]); |
||
15 | },formatIndexes:function(_4,_5){ |
||
16 | var f,g=this.grid,i=g.edit.info,d=this.get?this.get(_4[0],_5,_4):(this.value||this.defaultValue); |
||
17 | if(this.editable&&(this.alwaysEditing||(i.rowIndex==_4[0]&&i.cell==this))){ |
||
18 | return this.formatEditing(d,_4[0],_4); |
||
19 | }else{
|
||
20 | return this._defaultFormat(d,[d,_4[0],_4,this]); |
||
21 | } |
||
22 | },getOpenState:function(_6){ |
||
23 | var _7=this.grid,_8=_7.store,_9=null; |
||
24 | if(_8.isItem(_6)){
|
||
25 | _9=_6; |
||
26 | _6=_8.getIdentity(_6); |
||
27 | } |
||
28 | if(!this.openStates){ |
||
29 | this.openStates={};
|
||
30 | } |
||
31 | if(typeof _6!="string"||!(_6 in this.openStates)){ |
||
32 | this.openStates[_6]=_7.getDefaultOpenState(this,_9); |
||
33 | } |
||
34 | return this.openStates[_6]; |
||
35 | },formatAtLevel:function(_a,_b,_c,_d,_e,_f){ |
||
36 | if(!dojo.isArray(_a)){
|
||
37 | _a=[_a]; |
||
38 | } |
||
39 | var _10=""; |
||
40 | if(_c>this.level||(_c===this.level&&_d)){ |
||
41 | _f.push("dojoxGridSpacerCell");
|
||
42 | if(_c===this.level){ |
||
43 | _f.push("dojoxGridTotalCell");
|
||
44 | } |
||
45 | _10="<span></span>";
|
||
46 | }else{
|
||
47 | if(_c<this.level){ |
||
48 | _f.push("dojoxGridSummaryCell");
|
||
49 | _10="<span class=\"dojoxGridSummarySpan\">"+this.formatAggregate(_b,_c,_a)+"</span>"; |
||
50 | }else{
|
||
51 | var ret=""; |
||
52 | if(this.isCollapsable){ |
||
53 | var _11=this.grid.store,id=""; |
||
54 | if(_11.isItem(_b)){
|
||
55 | id=_11.getIdentity(_b); |
||
56 | } |
||
57 | _f.push("dojoxGridExpandoCell");
|
||
58 | ret="<span dojoType=\"dojox.grid._Expando\" level=\""+_c+"\" class=\"dojoxGridExpando\""+"\" toggleClass=\""+_e+"\" itemId=\""+id+"\" cellIdx=\""+this.index+"\"></span>"; |
||
59 | } |
||
60 | _10=ret+this.formatIndexes(_a,_b);
|
||
61 | } |
||
62 | } |
||
63 | if(this.grid.focus.cell&&this.index==this.grid.focus.cell.index&&_a.join("/")==this.grid.focus.rowIndex){ |
||
64 | _f.push(this.grid.focus.focusClass);
|
||
65 | } |
||
66 | return _10;
|
||
67 | }}; |
||
68 | } |