//>>built require({cache:{"url:dojox/grid/resources/Expando.html":"
\n"}}); define("dojox/grid/LazyTreeGrid",["dojo/_base/kernel","dojo/_base/declare","dojo/_base/lang","dojo/_base/event","dojo/_base/array","dojo/query","dojo/parser","dojo/dom-construct","dojo/dom-class","dojo/dom-style","dojo/dom-geometry","dojo/dom","dojo/keys","dojo/text!./resources/Expando.html","dijit/_Widget","dijit/_TemplatedMixin","./TreeGrid","./_Builder","./_View","./_Layout","./cells/tree","./_RowManager","./_FocusManager","./_EditManager","./DataSelection","./util"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a){ var _1b=_2("dojox.grid._LazyExpando",[_f,_10],{grid:null,view:null,rowIdx:-1,cellIdx:-1,level:0,itemId:"",templateString:_e,onToggle:function(evt){ if(this.grid._treeCache.items[this.rowIdx]){ this.grid.focus.setFocusIndex(this.rowIdx,this.cellIdx); this.setOpen(!this.grid._treeCache.items[this.rowIdx].opened); try{ _4.stop(evt); } catch(e){ } } },setOpen:function(_1c){ var g=this.grid,_1d=g._by_idx[this.rowIdx].item; if(_1d&&g.treeModel.mayHaveChildren(_1d)&&!g._loading&&g._treeCache.items[this.rowIdx].opened!==_1c){ g._treeCache.items[this.rowIdx].opened=_1c; g.expandoFetch(this.rowIdx,_1c); this._updateOpenState(_1d); } },_updateOpenState:function(_1e){ var g=this.grid,_1f; if(_1e&&g.treeModel.mayHaveChildren(_1e)){ _1f=g._treeCache.items[this.rowIdx].opened; this.expandoInner.innerHTML=_1f?"-":"+"; _9.toggle(this.domNode,"dojoxGridExpandoOpened",_1f); this.domNode.parentNode.setAttribute("aria-expanded",_1f); }else{ _9.remove(this.domNode,"dojoxGridExpandoOpened"); } },setRowNode:function(_20,_21,_22){ if(this.cellIdx<0||!this.itemId){ return false; } this.view=_22; this.grid=_22.grid; this.rowIdx=_20; var _23=this.grid.isLeftToRight()?"marginLeft":"marginRight"; _a.set(this.domNode.parentNode,_23,(this.level*1.125)+"em"); this._updateOpenState(this.grid._by_idx[this.rowIdx].item); return true; }}); var _24=_2("dojox.grid._TreeGridContentBuilder",_12._ContentBuilder,{generateHtml:function(_25,_26){ var _27=this.getTableArray(),_28=this.grid,v=this.view,_29=v.structure.cells,_2a=_28.getItem(_26),_2b=0,_2c="",_2d=_28._treeCache.items[_26]?_28._treeCache.items[_26].treePath:null; _1a.fire(this.view,"onBeforeRow",[_26,_29]); if(_2a&&_3.isArray(_2d)){ _2b=_2d.length; _2c=_28.treeModel.mayHaveChildren(_2a)?"":"dojoxGridNoChildren"; } var i=0,j=0,row,_2e,_2f,_30=0,_31=[]; for(;row=_29[j];j++){ if(row.hidden||row.header){ continue; } _27.push(""); _2f=this._getColSpans(_2b); if(_2f){ _5.forEach(_2f,function(c){ for(i=0;_2e=row[i];i++){ if(i>=c.start&&i<=c.end){ _30+=this._getCellWidth(row,i); } } _31.push(_30); _30=0; },this); } var m,cc,cs,pbm,k=0; for(i=0;_2e=row[i];i++){ m=_2e.markup; cc=_2e.customClasses=[]; cs=_2e.customStyles=[]; if(_2f&&_2f[k]&&(i>=_2f[k].start&&i<=_2f[k].end)){ var _32=_2f[k].primary||_2f[k].start; if(i==_32){ m[5]=_2e.formatAtLevel(_2a,_2b,_26); m[1]=cc.join(" "); pbm=_b.getMarginBox(_2e.getHeaderNode()).w-_b.getContentBox(_2e.getHeaderNode()).w; cs=_2e.customStyles=["width:"+(_31[k]-pbm)+"px"]; m[3]=cs.join(";"); _27.push.apply(_27,m); }else{ if(i==_2f[k].end){ k++; continue; }else{ continue; } } }else{ m[5]=_2e.formatAtLevel(_2a,_2b,_26); m[1]=cc.join(" "); m[3]=cs.join(";"); _27.push.apply(_27,m); } } _27.push(""); } _27.push(""); return _27.join(""); },_getColSpans:function(_33){ var _34=this.grid.colSpans; return _34&&_34[_33]?_34[_33]:null; },_getCellWidth:function(_35,_36){ var _37=_35[_36],_38=_37.getHeaderNode(); if(_37.hidden){ return 0; } if(_36==_35.length-1||_5.every(_35.slice(_36+1),function(_39){ return _39.hidden; })){ var _3a=_b.position(_35[_36].view.headerContentNode.firstChild); return _3a.x+_3a.w-_b.position(_38).x; }else{ var _3b; do{ _3b=_35[++_36]; }while(_3b.hidden); return _b.position(_3b.getHeaderNode()).x-_b.position(_38).x; } }}); _2("dojox.grid._TreeGridView",_13,{_contentBuilderClass:_24,postCreate:function(){ this.inherited(arguments); this._expandos={}; this.connect(this.grid,"_onCleanupExpandoCache","_cleanupExpandoCache"); },destroy:function(){ this._cleanupExpandoCache(); this.inherited(arguments); },_cleanupExpandoCache:function(_3c){ if(_3c&&this._expandos[_3c]){ this._expandos[_3c].destroy(); delete this._expandos[_3c]; }else{ var i; for(i in this._expandos){ this._expandos[i].destroy(); } this._expandos={}; } },onAfterRow:function(_3d,_3e,_3f){ _6("span.dojoxGridExpando",_3f).forEach(function(n){ if(n&&n.parentNode){ var _40,_41,_42=this.grid._by_idx; if(_42&&_42[_3d]&&_42[_3d].idty){ _40=_42[_3d].idty; _41=this._expandos[_40]; } if(_41){ _8.place(_41.domNode,n,"replace"); _41.itemId=n.getAttribute("itemId"); _41.cellIdx=parseInt(n.getAttribute("cellIdx"),10); if(isNaN(_41.cellIdx)){ _41.cellIdx=-1; } }else{ _41=_7.parse(n.parentNode)[0]; if(_40){ this._expandos[_40]=_41; } } if(!_41.setRowNode(_3d,_3f,this)){ _41.domNode.parentNode.removeChild(_41.domNode); } _8.destroy(n); } },this); this.inherited(arguments); },updateRow:function(_43){ var _44=this.grid,_45; if(_44.keepSelection){ _45=_44.getItem(_43); if(_45){ _44.selection.preserver._reSelectById(_45,_43); } } this.inherited(arguments); }}); var _46=_3.mixin(_3.clone(_15),{formatAtLevel:function(_47,_48,_49){ if(!_47){ return this.formatIndexes(_49,_47,_48); } var _4a="",ret="",_4b; if(this.isCollapsable&&this.grid.store.isItem(_47)){ ret=""; } _4b=this.formatIndexes(_49,_47,_48); _4a=ret!==""?"
"+ret+_4b+"
":_4b; return _4a; },formatIndexes:function(_4c,_4d,_4e){ var _4f=this.grid.edit.info,d=this.get?this.get(_4c,_4d):(this.value||this.defaultValue); if(this.editable&&(this.alwaysEditing||(_4f.rowIndex===_4c&&_4f.cell===this))){ return this.formatEditing(d,_4c); }else{ return this._defaultFormat(d,[d,_4c,_4e,this]); } }}); var _50=_2("dojox.grid._LazyTreeLayout",_14,{setStructure:function(_51){ var g=this.grid,s=_51; if(g&&!_5.every(s,function(i){ return !!i.cells; })){ s=arguments[0]=[{cells:[s]}]; } if(s.length===1&&s[0].cells.length===1){ s[0].type="dojox.grid._TreeGridView"; this._isCollapsable=true; s[0].cells[0][this.grid.expandoCell].isCollapsable=true; } this.inherited(arguments); },addCellDef:function(_52,_53,def){ var obj=this.inherited(arguments); return _3.mixin(obj,_46); }}); var _54=_2("dojox.grid._LazyTreeGridCache",null,{constructor:function(){ this.items=[]; },getSiblingIndex:function(_55,_56){ var i=_55-1,_57=0,tp; for(;i>=0;i--){ tp=this.items[i]?this.items[i].treePath:[]; if(tp.join("/")===_56.join("/")){ _57++; }else{ if(tp.length<_56.length){ break; } } } return _57; },removeChildren:function(_58){ var i=_58+1,_59,tp,_5a=this.items[_58]?this.items[_58].treePath:[]; for(;i=0){ if(_6f[_73]&&_6f[_73].opened){ var _74=_6f[_73].treePath,pos=_73+1; for(;pos<_6f.length;pos++){ if(_6f[pos].treePath.length<=_74.length){ break; } } var _75=_74.slice(); _75.push(_72); this._treeCache.items.splice(pos,0,{opened:false,treePath:_75}); var _76=this.store.getIdentity(_6c); this._by_idty[_76]={idty:_76,item:_6c}; _70.splice(pos,0,this._by_idty[_76]); this._size+=1; this.updateRowCount(this._size); this._updateRenderedRows(pos); }else{ this.updateRow(_73); } } } },_onDelete:function(_77){ var i=0,_78=-1,_79=this.store.getIdentity(_77); for(;i=0){ var _7a=this._treeCache.items,_7b=_7a[_78]?_7a[_78].treePath:[],tp,_7c=1; i=_78+1; for(;i0?Math.min(this.rowsPerPage,this._size-_7e):this.rowsPerPage; var i=0; var _81=[]; this._reqQueueLen=0; for(;i<_80;i++){ if(this._by_idx[_7e+i]){ _81.push(this._by_idx[_7e+i].item); }else{ break; } } if(_81.length===_80){ this._reqQueueLen=1; this._onFetchBegin(this._size,{startRowIdx:_7e,count:_80}); this._onFetchComplete(_81,{startRowIdx:_7e,count:_80}); }else{ var _82,_83,len=1,_84=this._treeCache.items,_85=_84[_7e]?_84[_7e].treePath:[]; for(i=1;i<_80;i++){ _82=_84[_7e+len-1]?_84[_7e+len-1].treePath.length:0; _83=_84[_7e+len]?_84[_7e+len].treePath.length:0; if(_82!==_83){ this._reqQueueLen++; this._fetchItems({startRowIdx:_7e,count:len,treePath:_85}); _7e=_7e+len; len=1; _85=_84[_7e]?_84[_7e].treePath:0; }else{ len++; } } this._reqQueueLen++; this._fetchItems({startRowIdx:_7e,count:len,treePath:_85}); } },_fetchItems:function(req){ if(this._pending_requests[req.startRowIdx]){ return; } this.showMessage(this.loadingMessage); this._pending_requests[req.startRowIdx]=true; var _86=_3.hitch(this,"_onFetchError"),_87=this._treeCache.getSiblingIndex(req.startRowIdx,req.treePath); if(req.treePath.length===0){ this.store.fetch({start:_87,startRowIdx:req.startRowIdx,treePath:req.treePath,count:req.count,query:this.query,sort:this.getSortProps(),queryOptions:this.queryOptions,onBegin:_3.hitch(this,"_onFetchBegin"),onComplete:_3.hitch(this,"_onFetchComplete"),onError:_3.hitch(this,"_onFetchError")}); }else{ var _88=req.treePath[req.treePath.length-1],_89; var _8a={start:_87,startRowIdx:req.startRowIdx,treePath:req.treePath,count:req.count,parentId:_88,sort:this.getSortProps()}; var _8b=this; var _8c=function(){ var f=_3.hitch(_8b,"_onFetchComplete"); if(arguments.length==1){ f.apply(_8b,[arguments[0],_8a]); }else{ f.apply(_8b,arguments); } }; if(this._by_idty[_88]){ _89=this._by_idty[_88].item; this.treeModel.getChildren(_89,_8c,_86,_8a); }else{ this.store.fetchItemByIdentity({identity:_88,onItem:function(_8d){ _8b.treeModel.getChildren(_8d,_8c,_86,_8a); },onError:_86}); } } },_onFetchBegin:function(_8e,_8f){ if(this._treeCache.items.length===0){ this._size=parseInt(_8e,10); } _8e=this._size; this.inherited(arguments); },_onFetchComplete:function(_90,_91){ var _92=_91.startRowIdx,_93=_91.count,_94=_90.length<=_93?0:_91.start,_95=_91.treePath||[]; if(_3.isArray(_90)&&_90.length>0){ var i=0,len=Math.min(_93,_90.length); for(;i=_a7){ this.updateRows(p*this.rowsPerPage,this.rowsPerPage); }else{ if((p+1)*this.rowsPerPage>=_a7){ this.updateRows(_a7,(p+1)*this.rowsPerPage-_a7+1); } } },this); },_fold:function(_a8,_a9){ var _aa=-1,i=0,_ab=this._by_idx,_ac=this._by_idty[_a8]; if(_ac&&_ac.item&&this.treeModel.mayHaveChildren(_ac.item)){ for(;i<_ab.length;i++){ if(_ab[i]&&_ab[i].idty===_a8){ _aa=i; break; } } if(_aa>=0){ var _ad=this.views.views[this.views.views.length-1].getRowNode(_aa); if(_ad){ var _ae=dijit.findWidgets(_ad)[0]; if(_ae){ _ae.setOpen(_a9); } } } } }}); _5b.markupFactory=function(_af,_b0,_b1,_b2){ return _11.markupFactory(_af,_b0,_b1,_b2); }; return _5b; });