$A.TreeGrid=Ext.extend($A.Grid,{initComponent:function(d){$A.TreeGrid.superclass.initComponent.call(this,d);if(this.lockColumns.length>0){var c=this.id+"_lb_tree",e=this.createTreeConfig(d,this.lockColumns,c,true,this);this.lb.set({id:c}).addClass("item-treegrid");var b=this.lockTree=new $A.Tree(e);b.body=this.lb;b.treegrid=this;b.on("render",function(){this.processData();Ext.DomHelper.insertHtml("beforeEnd",this.lb.dom,'<div style="height:17px"></div>')},this);b.on("expand",function(h,i){this.unlockTree.getNodeById(i.id).expand()},this);b.on("collapse",function(h,i){this.unlockTree.getNodeById(i.id).collapse()},this);delete d.marginheight;delete d.marginwidth}var f=this.id+"_ub_tree",a=this.createTreeConfig(d,this.unlockColumns,f,this.lockColumns.length==0,this);this.ub.set({id:f}).addClass("item-treegrid");var g=this.unlockTree=new $A.Tree(a);g.body=this.ub;g.treegrid=this;g.on("render",this.processData,this)},initTemplate:function(){$A.TreeGrid.superclass.initTemplate.call(this);this.cbTpl=new Ext.Template('<center style="width:{width}px"><div class="{cellcls}" style="height:13px;padding:0px;" id="'+this.id+'_{name}_{recordid}"></div></center>')},createTemplateData:function(b,a){return{width:b.width-2,recordid:a.id,visibility:b.hidden===true?"hidden":"visible",name:b.name}},createTreeConfig:function(b,e,h,a,d){var g=e[0],f=g?g.width:150;return Ext.apply(b,{sw:20,id:h,showSkeleton:a,width:f,column:g,displayfield:g.name,renderer:g.renderer,initColumns:function(c){if(c.isRoot()&&c.ownerTree.showRoot==false){return}Ext.each(e,function(m){if(m.name==c.ownerTree.displayfield){return}var i=m.name,l=c.els[i+"_td"]=document.createElement("td"),j=c.record,k=m.align;l._type_="text";l.atype="grid-cell";l.dataindex=i;l.recordid=j.id;if(k){l.style.textAlign=k}Ext.fly(l).setWidth(m.width-2).addClass("node-text");l.appendChild(c.els[i+"_text"]=Ext.DomHelper.insertHtml("afterBegin",l,d.createCell(m,j,false)));c.els.itemNodeTr.appendChild(l)})},createTreeNode:function(c){return new $A.Tree.TreeGridNode(c)},onNodeSelect:function(c){c.itemNodeTable.style.backgroundColor="#dfeaf5"},onNodeUnSelect:function(c){c.itemNodeTable.style.backgroundColor=""}})},processData:function(a,b){if(!b){return}var c=[];if(a.showRoot){this.processNode(c,b)}else{Ext.each(b.children,function(d){this.processNode(c,d)},this)}this.dataset.data=c},onLoad:function(){this.drawFootBar();$A.Masker.unmask(this.wb)},processNode:function(a,b){a.add(b.record);Ext.each(b.children,function(c){this.processNode(a,c)},this)},bind:function(a){if(typeof(a)==="string"){a=$A.CmpManager.get(a);if(!a){return}}this.dataset=a;this.processDataSetLiestener("on");if(this.lockTree){this.lockTree.bind(a)}this.unlockTree.bind(a);this.drawFootBar()},setColumnSize:function(b,d){$A.TreeGrid.superclass.setColumnSize.call(this,b,d);var e=this.findColByName(b),a=e.lock==true?this.lockTree:this.unlockTree;e.width=d;if(b==a.displayfield){a.width=d}a.root.setWidth(b,d)},renderLockArea:function(){var a=0;Ext.each(this.columns,function(b){if(b.lock===true&&b.hidden!==true){a+=b.width}});this.lockWidth=a},focusRow:function(e){var f=0,b=this.unlockTree,d=b.nodeHash,a=this.dataset.data;for(var c=0;c<e;c++){if(b.isAllParentExpand(d[a[c].id])){f++}}$A.TreeGrid.superclass.focusRow.call(this,f)},onMouseWheel:function(a){}});$A.Tree.TreeGridNode=Ext.extend($A.Tree.TreeNode,{createNode:function(a){return new $A.Tree.TreeGridNode(a)},createCellEl:function(d){var b=this.getOwnerTree(),a=b.column,f=a.align,c=this.record,e=this.els[d+"_td"];this.els[d+"_text"]=Ext.DomHelper.insertHtml("afterBegin",this.els[d+"_td"],b.treegrid.createCell(a,c,false));e.dataindex=d;e.atype="grid-cell";e.recordid=c.id;if(f){e.style.textAlign=f}},paintText:function(){},render:function(){$A.Tree.TreeGridNode.superclass.render.call(this);var a=this.getOwnerTree();this.setWidth(a.displayfield,a.width)}});