/**
 * jQuery EasyUI 1.3.2
 * 
 * Copyright (c) 2009-2013 www.jeasyui.com. All rights reserved.
 *
 * Licensed under the GPL or commercial licenses
 * To use it on other terms please contact us: jeasyui@gmail.com
 * http://www.gnu.org/licenses/gpl.txt
 * http://www.jeasyui.com/license_commercial.php
 *
 */
(function($){
function _1(a,o){
for(var i=0,_2=a.length;i<_2;i++){
if(a[i]==o){
return i;
}
}
return -1;
};
function _3(a,o){
var _4=_1(a,o);
if(_4!=-1){
a.splice(_4,1);
}
};
function _5(_6){
var _7=$.data(_6,"treegrid").options;
$(_6).datagrid($.extend({},_7,{url:null,data:null,loader:function(){
return false;
},onLoadSuccess:function(){
},onResizeColumn:function(_8,_9){
_21(_6);
_7.onResizeColumn.call(_6,_8,_9);
},onSortColumn:function(_a,_b){
_7.sortName=_a;
_7.sortOrder=_b;
if(_7.remoteSort){
_20(_6);
}else{
var _c=$(_6).treegrid("getData");
_3a(_6,0,_c);
}
_7.onSortColumn.call(_6,_a,_b);
},onBeforeEdit:function(_d,_e){
if(_7.onBeforeEdit.call(_6,_e)==false){
return false;
}
},onAfterEdit:function(_f,row,_10){
_7.onAfterEdit.call(_6,row,_10);
},onCancelEdit:function(_11,row){
_7.onCancelEdit.call(_6,row);
},onSelect:function(_12){
_7.onSelect.call(_6,_41(_6,_12));
},onUnselect:function(_13){
_7.onUnselect.call(_6,_41(_6,_13));
},onSelectAll:function(){
_7.onSelectAll.call(_6,$.data(_6,"treegrid").data);
},onUnselectAll:function(){
_7.onUnselectAll.call(_6,$.data(_6,"treegrid").data);
},onCheck:function(_14){
_7.onCheck.call(_6,_41(_6,_14));
},onUncheck:function(_15){
_7.onUncheck.call(_6,_41(_6,_15));
},onCheckAll:function(){
_7.onCheckAll.call(_6,$.data(_6,"treegrid").data);
},onUncheckAll:function(){
_7.onUncheckAll.call(_6,$.data(_6,"treegrid").data);
},onClickRow:function(_16){
_7.onClickRow.call(_6,_41(_6,_16));
},onDblClickRow:function(_17){
_7.onDblClickRow.call(_6,_41(_6,_17));
},onClickCell:function(_18,_19){
_7.onClickCell.call(_6,_19,_41(_6,_18));
},onDblClickCell:function(_1a,_1b){
_7.onDblClickCell.call(_6,_1b,_41(_6,_1a));
},onRowContextMenu:function(e,_1c){
_7.onContextMenu.call(_6,e,_41(_6,_1c));
}}));
if(_7.pagination){
var _1d=$(_6).datagrid("getPager");
_1d.pagination({pageNumber:_7.pageNumber,pageSize:_7.pageSize,pageList:_7.pageList,onSelectPage:function(_1e,_1f){
_7.pageNumber=_1e;
_7.pageSize=_1f;
_20(_6);
}});
_7.pageSize=_1d.pagination("options").pageSize;
}
};
function _21(_22,_23){
var _24=$.data(_22,"datagrid").options;
var dc=$.data(_22,"datagrid").dc;
if(!dc.body1.is(":empty")&&(!_24.nowrap||_24.autoRowHeight)){
if(_23!=undefined){
var _25=_26(_22,_23);
for(var i=0;i<_25.length;i++){
_27(_25[i][_24.idField]);
}
}
}
$(_22).datagrid("fixRowHeight",_23);
function _27(_28){
var tr1=_24.finder.getTr(_22,_28,"body",1);
var tr2=_24.finder.getTr(_22,_28,"body",2);
tr1.css("height","");
tr2.css("height","");
var _29=Math.max(tr1.height(),tr2.height());
tr1.css("height",_29);
tr2.css("height",_29);
};
};
function _2a(_2b){
var dc=$.data(_2b,"datagrid").dc;
var _2c=$.data(_2b,"treegrid").options;
if(!_2c.rownumbers){
return;
}
dc.body1.find("div.datagrid-cell-rownumber").each(function(i){
$(this).html(i+1);
});
};
function _2d(_2e){
var dc=$.data(_2e,"datagrid").dc;
var _2f=dc.body1.add(dc.body2);
var _30=($.data(_2f[0],"events")||$._data(_2f[0],"events")).click[0].handler;
dc.body1.add(dc.body2).bind("mouseover",function(e){
var tt=$(e.target);
var tr=tt.closest("tr.datagrid-row");
if(!tr.length){
return;
}
if(tt.hasClass("tree-hit")){
tt.hasClass("tree-expanded")?tt.addClass("tree-expanded-hover"):tt.addClass("tree-collapsed-hover");
}
e.stopPropagation();
}).bind("mouseout",function(e){
var tt=$(e.target);
var tr=tt.closest("tr.datagrid-row");
if(!tr.length){
return;
}
if(tt.hasClass("tree-hit")){
tt.hasClass("tree-expanded")?tt.removeClass("tree-expanded-hover"):tt.removeClass("tree-collapsed-hover");
}
e.stopPropagation();
}).unbind("click").bind("click",function(e){
var tt=$(e.target);
var tr=tt.closest("tr.datagrid-row");
if(!tr.length){
return;
}
if(tt.hasClass("tree-hit")){
_31(_2e,tr.attr("node-id"));
}else{
_30(e);
}
e.stopPropagation();
});
};
function _32(_33,_34){
var _35=$.data(_33,"treegrid").options;
var tr1=_35.finder.getTr(_33,_34,"body",1);
var tr2=_35.finder.getTr(_33,_34,"body",2);
var _36=$(_33).datagrid("getColumnFields",true).length+(_35.rownumbers?1:0);
var _37=$(_33).datagrid("getColumnFields",false).length;
_38(tr1,_36);
_38(tr2,_37);
function _38(tr,_39){
$("<tr class=\"treegrid-tr-tree\">"+"<td style=\"border:0px\" colspan=\""+_39+"\">"+"<div></div>"+"</td>"+"</tr>").insertAfter(tr);
};
};
function _3a(_3b,_3c,_3d,_3e){
var _3f=$.data(_3b,"treegrid").options;
var dc=$.data(_3b,"datagrid").dc;
_3d=_3f.loadFilter.call(_3b,_3d,_3c);
var _40=_41(_3b,_3c);
if(_40){
var _42=_3f.finder.getTr(_3b,_3c,"body",1);
var _43=_3f.finder.getTr(_3b,_3c,"body",2);
var cc1=_42.next("tr.treegrid-tr-tree").children("td").children("div");
var cc2=_43.next("tr.treegrid-tr-tree").children("td").children("div");
}else{
var cc1=dc.body1;
var cc2=dc.body2;
}
if(!_3e){
$.data(_3b,"treegrid").data=[];
cc1.empty();
cc2.empty();
}
if(_3f.view.onBeforeRender){
_3f.view.onBeforeRender.call(_3f.view,_3b,_3c,_3d);
}
_3f.view.render.call(_3f.view,_3b,cc1,true);
_3f.view.render.call(_3f.view,_3b,cc2,false);
if(_3f.showFooter){
_3f.view.renderFooter.call(_3f.view,_3b,dc.footer1,true);
_3f.view.renderFooter.call(_3f.view,_3b,dc.footer2,false);
}
if(_3f.view.onAfterRender){
_3f.view.onAfterRender.call(_3f.view,_3b);
}
_3f.onLoadSuccess.call(_3b,_40,_3d);
if(!_3c&&_3f.pagination){
var _44=$.data(_3b,"treegrid").total;
var _45=$(_3b).datagrid("getPager");
if(_45.pagination("options").total!=_44){
_45.pagination({total:_44});
}
}
_21(_3b);
_2a(_3b);
$(_3b).treegrid("autoSizeColumn");
};
function _20(_46,_47,_48,_49,_4a){
var _4b=$.data(_46,"treegrid").options;
var _4c=$(_46).datagrid("getPanel").find("div.datagrid-body");
if(_48){
_4b.queryParams=_48;
}
var _4d=$.extend({},_4b.queryParams);
if(_4b.pagination){
$.extend(_4d,{page:_4b.pageNumber,rows:_4b.pageSize});
}
if(_4b.sortName){
$.extend(_4d,{sort:_4b.sortName,order:_4b.sortOrder});
}
var row=_41(_46,_47);
if(_4b.onBeforeLoad.call(_46,row,_4d)==false){
return;
}
var _4e=_4c.find("tr[node-id="+_47+"] span.tree-folder");
_4e.addClass("tree-loading");
$(_46).treegrid("loading");
var _4f=_4b.loader.call(_46,_4d,function(_50){
_4e.removeClass("tree-loading");
$(_46).treegrid("loaded");
_3a(_46,_47,_50,_49);
if(_4a){
_4a();
}
},function(){
_4e.removeClass("tree-loading");
$(_46).treegrid("loaded");
_4b.onLoadError.apply(_46,arguments);
if(_4a){
_4a();
}
});
if(_4f==false){
_4e.removeClass("tree-loading");
$(_46).treegrid("loaded");
}
};
function _51(_52){
var _53=_54(_52);
if(_53.length){
return _53[0];
}else{
return null;
}
};
function _54(_55){
return $.data(_55,"treegrid").data;
};
function _56(_57,_58){
var row=_41(_57,_58);
if(row._parentId){
return _41(_57,row._parentId);
}else{
return null;
}
};
function _26(_59,_5a){
var _5b=$.data(_59,"treegrid").options;
var _5c=$(_59).datagrid("getPanel").find("div.datagrid-view2 div.datagrid-body");
var _5d=[];
if(_5a){
_5e(_5a);
}else{
var _5f=_54(_59);
for(var i=0;i<_5f.length;i++){
_5d.push(_5f[i]);
_5e(_5f[i][_5b.idField]);
}
}
function _5e(_60){
var _61=_41(_59,_60);
if(_61&&_61.children){
for(var i=0,len=_61.children.length;i<len;i++){
var _62=_61.children[i];
_5d.push(_62);
_5e(_62[_5b.idField]);
}
}
};
return _5d;
};
function _63(_64){
var _65=_66(_64);
if(_65.length){
return _65[0];
}else{
return null;
}
};
function _66(_67){
var _68=[];
var _69=$(_67).datagrid("getPanel");
_69.find("div.datagrid-view2 div.datagrid-body tr.datagrid-row-selected").each(function(){
var id=$(this).attr("node-id");
_68.push(_41(_67,id));
});
return _68;
};
function _6a(_6b,_6c){
if(!_6c){
return 0;
}
var _6d=$.data(_6b,"treegrid").options;
var _6e=$(_6b).datagrid("getPanel").children("div.datagrid-view");
var _6f=_6e.find("div.datagrid-body tr[node-id="+_6c+"]").children("td[field="+_6d.treeField+"]");
return _6f.find("span.tree-indent,span.tree-hit").length;
};
function _41(_70,_71){
var _72=$.data(_70,"treegrid").options;
var _73=$.data(_70,"treegrid").data;
var cc=[_73];
while(cc.length){
var c=cc.shift();
for(var i=0;i<c.length;i++){
var _74=c[i];
if(_74[_72.idField]==_71){
return _74;
}else{
if(_74["children"]){
cc.push(_74["children"]);
}
}
}
}
return null;
};
function _75(_76,_77){
var _78=$.data(_76,"treegrid").options;
var row=_41(_76,_77);
var tr=_78.finder.getTr(_76,_77);
var hit=tr.find("span.tree-hit");
if(hit.length==0){
return;
}
if(hit.hasClass("tree-collapsed")){
return;
}
if(_78.onBeforeCollapse.call(_76,row)==false){
return;
}
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed");
hit.next().removeClass("tree-folder-open");
row.state="closed";
tr=tr.next("tr.treegrid-tr-tree");
var cc=tr.children("td").children("div");
if(_78.animate){
cc.slideUp("normal",function(){
$(_76).treegrid("autoSizeColumn");
_21(_76,_77);
_78.onCollapse.call(_76,row);
});
}else{
cc.hide();
$(_76).treegrid("autoSizeColumn");
_21(_76,_77);
_78.onCollapse.call(_76,row);
}
};
function _79(_7a,_7b){
var _7c=$.data(_7a,"treegrid").options;
var tr=_7c.finder.getTr(_7a,_7b);
var hit=tr.find("span.tree-hit");
var row=_41(_7a,_7b);
if(hit.length==0){
return;
}
if(hit.hasClass("tree-expanded")){
return;
}
if(_7c.onBeforeExpand.call(_7a,row)==false){
return;
}
hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded");
hit.next().addClass("tree-folder-open");
var _7d=tr.next("tr.treegrid-tr-tree");
if(_7d.length){
var cc=_7d.children("td").children("div");
_7e(cc);
}else{
_32(_7a,row[_7c.idField]);
var _7d=tr.next("tr.treegrid-tr-tree");
var cc=_7d.children("td").children("div");
cc.hide();
_20(_7a,row[_7c.idField],{id:row[_7c.idField]},true,function(){
if(cc.is(":empty")){
_7d.remove();
}else{
_7e(cc);
}
});
}
function _7e(cc){
row.state="open";
if(_7c.animate){
cc.slideDown("normal",function(){
$(_7a).treegrid("autoSizeColumn");
_21(_7a,_7b);
_7c.onExpand.call(_7a,row);
});
}else{
cc.show();
$(_7a).treegrid("autoSizeColumn");
_21(_7a,_7b);
_7c.onExpand.call(_7a,row);
}
};
};
function _31(_7f,_80){
var _81=$.data(_7f,"treegrid").options;
var tr=_81.finder.getTr(_7f,_80);
var hit=tr.find("span.tree-hit");
if(hit.hasClass("tree-expanded")){
_75(_7f,_80);
}else{
_79(_7f,_80);
}
};
function _82(_83,_84){
var _85=$.data(_83,"treegrid").options;
var _86=_26(_83,_84);
if(_84){
_86.unshift(_41(_83,_84));
}
for(var i=0;i<_86.length;i++){
_75(_83,_86[i][_85.idField]);
}
};
function _87(_88,_89){
var _8a=$.data(_88,"treegrid").options;
var _8b=_26(_88,_89);
if(_89){
_8b.unshift(_41(_88,_89));
}
for(var i=0;i<_8b.length;i++){
_79(_88,_8b[i][_8a.idField]);
}
};
function _8c(_8d,_8e){
var _8f=$.data(_8d,"treegrid").options;
var ids=[];
var p=_56(_8d,_8e);
while(p){
var id=p[_8f.idField];
ids.unshift(id);
p=_56(_8d,id);
}
for(var i=0;i<ids.length;i++){
_79(_8d,ids[i]);
}
};
function _90(_91,_92){
var _93=$.data(_91,"treegrid").options;
if(_92.parent){
var tr=_93.finder.getTr(_91,_92.parent);
if(tr.next("tr.treegrid-tr-tree").length==0){
_32(_91,_92.parent);
}
var _94=tr.children("td[field="+_93.treeField+"]").children("div.datagrid-cell");
var _95=_94.children("span.tree-icon");
if(_95.hasClass("tree-file")){
_95.removeClass("tree-file").addClass("tree-folder");
var hit=$("<span class=\"tree-hit tree-expanded\"></span>").insertBefore(_95);
if(hit.prev().length){
hit.prev().remove();
}
}
}
_3a(_91,_92.parent,_92.data,true);
};
function _96(_97,_98){
var ref=_98.before||_98.after;
var _99=$.data(_97,"treegrid").options;
var _9a=_56(_97,ref);
_90(_97,{parent:(_9a?_9a[_99.idField]:null),data:[_98.data]});
_9b(true);
_9b(false);
_2a(_97);
function _9b(_9c){
var _9d=_9c?1:2;
var tr=_99.finder.getTr(_97,_98.data[_99.idField],"body",_9d);
var _9e=tr.closest("table.datagrid-btable");
tr=tr.parent().children();
var _9f=_99.finder.getTr(_97,ref,"body",_9d);
if(_98.before){
tr.insertBefore(_9f);
}else{
var sub=_9f.next("tr.treegrid-tr-tree");
tr.insertAfter(sub.length?sub:_9f);
}
_9e.remove();
};
};
function _a0(_a1,_a2){
var _a3=$.data(_a1,"treegrid").options;
var tr=_a3.finder.getTr(_a1,_a2);
tr.next("tr.treegrid-tr-tree").remove();
tr.remove();
var _a4=del(_a2);
if(_a4){
if(_a4.children.length==0){
tr=_a3.finder.getTr(_a1,_a4[_a3.idField]);
tr.next("tr.treegrid-tr-tree").remove();
var _a5=tr.children("td[field="+_a3.treeField+"]").children("div.datagrid-cell");
_a5.find(".tree-icon").removeClass("tree-folder").addClass("tree-file");
_a5.find(".tree-hit").remove();
$("<span class=\"tree-indent\"></span>").prependTo(_a5);
}
}
_2a(_a1);
function del(id){
var cc;
var _a6=_56(_a1,_a2);
if(_a6){
cc=_a6.children;
}else{
cc=$(_a1).treegrid("getData");
}
for(var i=0;i<cc.length;i++){
if(cc[i][_a3.idField]==id){
cc.splice(i,1);
break;
}
}
return _a6;
};
};
$.fn.treegrid=function(_a7,_a8){
if(typeof _a7=="string"){
var _a9=$.fn.treegrid.methods[_a7];
if(_a9){
return _a9(this,_a8);
}else{
return this.datagrid(_a7,_a8);
}
}
_a7=_a7||{};
return this.each(function(){
var _aa=$.data(this,"treegrid");
if(_aa){
$.extend(_aa.options,_a7);
}else{
_aa=$.data(this,"treegrid",{options:$.extend({},$.fn.treegrid.defaults,$.fn.treegrid.parseOptions(this),_a7),data:[]});
}
_5(this);
if(_aa.options.data){
$(this).treegrid("loadData",_aa.options.data);
}
_20(this);
_2d(this);
});
};
$.fn.treegrid.methods={options:function(jq){
return $.data(jq[0],"treegrid").options;
},resize:function(jq,_ab){
return jq.each(function(){
$(this).datagrid("resize",_ab);
});
},fixRowHeight:function(jq,_ac){
return jq.each(function(){
_21(this,_ac);
});
},loadData:function(jq,_ad){
return jq.each(function(){
_3a(this,null,_ad);
});
},reload:function(jq,id){
return jq.each(function(){
if(id){
var _ae=$(this).treegrid("find",id);
if(_ae.children){
_ae.children.splice(0,_ae.children.length);
}
var _af=$(this).datagrid("getPanel").find("div.datagrid-body");
var tr=_af.find("tr[node-id="+id+"]");
tr.next("tr.treegrid-tr-tree").remove();
var hit=tr.find("span.tree-hit");
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed");
_79(this,id);
}else{
_20(this,null,{});
}
});
},reloadFooter:function(jq,_b0){
return jq.each(function(){
var _b1=$.data(this,"treegrid").options;
var dc=$.data(this,"datagrid").dc;
if(_b0){
$.data(this,"treegrid").footer=_b0;
}
if(_b1.showFooter){
_b1.view.renderFooter.call(_b1.view,this,dc.footer1,true);
_b1.view.renderFooter.call(_b1.view,this,dc.footer2,false);
if(_b1.view.onAfterRender){
_b1.view.onAfterRender.call(_b1.view,this);
}
$(this).treegrid("fixRowHeight");
}
});
},getData:function(jq){
return $.data(jq[0],"treegrid").data;
},getFooterRows:function(jq){
return $.data(jq[0],"treegrid").footer;
},getRoot:function(jq){
return _51(jq[0]);
},getRoots:function(jq){
return _54(jq[0]);
},getParent:function(jq,id){
return _56(jq[0],id);
},getChildren:function(jq,id){
return _26(jq[0],id);
},getSelected:function(jq){
return _63(jq[0]);
},getSelections:function(jq){
return _66(jq[0]);
},getLevel:function(jq,id){
return _6a(jq[0],id);
},find:function(jq,id){
return _41(jq[0],id);
},isLeaf:function(jq,id){
var _b2=$.data(jq[0],"treegrid").options;
var tr=_b2.finder.getTr(jq[0],id);
var hit=tr.find("span.tree-hit");
return hit.length==0;
},select:function(jq,id){
return jq.each(function(){
$(this).datagrid("selectRow",id);
});
},unselect:function(jq,id){
return jq.each(function(){
$(this).datagrid("unselectRow",id);
});
},collapse:function(jq,id){
return jq.each(function(){
_75(this,id);
});
},expand:function(jq,id){
return jq.each(function(){
_79(this,id);
});
},toggle:function(jq,id){
return jq.each(function(){
_31(this,id);
});
},collapseAll:function(jq,id){
return jq.each(function(){
_82(this,id);
});
},expandAll:function(jq,id){
return jq.each(function(){
_87(this,id);
});
},expandTo:function(jq,id){
return jq.each(function(){
_8c(this,id);
});
},append:function(jq,_b3){
return jq.each(function(){
_90(this,_b3);
});
},insert:function(jq,_b4){
return jq.each(function(){
_96(this,_b4);
});
},remove:function(jq,id){
return jq.each(function(){
_a0(this,id);
});
},pop:function(jq,id){
var row=jq.treegrid("find",id);
jq.treegrid("remove",id);
return row;
},refresh:function(jq,id){
return jq.each(function(){
var _b5=$.data(this,"treegrid").options;
_b5.view.refreshRow.call(_b5.view,this,id);
});
},update:function(jq,_b6){
return jq.each(function(){
var _b7=$.data(this,"treegrid").options;
_b7.view.updateRow.call(_b7.view,this,_b6.id,_b6.row);
});
},beginEdit:function(jq,id){
return jq.each(function(){
$(this).datagrid("beginEdit",id);
$(this).treegrid("fixRowHeight",id);
});
},endEdit:function(jq,id){
return jq.each(function(){
$(this).datagrid("endEdit",id);
});
},cancelEdit:function(jq,id){
return jq.each(function(){
$(this).datagrid("cancelEdit",id);
});
}};
$.fn.treegrid.parseOptions=function(_b8){
return $.extend({},$.fn.datagrid.parseOptions(_b8),$.parser.parseOptions(_b8,["treeField",{animate:"boolean"}]));
};
var _b9=$.extend({},$.fn.datagrid.defaults.view,{render:function(_ba,_bb,_bc){
var _bd=$.data(_ba,"treegrid").options;
var _be=$(_ba).datagrid("getColumnFields",_bc);
var _bf=$.data(_ba,"datagrid").rowIdPrefix;
if(_bc){
if(!(_bd.rownumbers||(_bd.frozenColumns&&_bd.frozenColumns.length))){
return;
}
}
var _c0=this;
var _c1=_c2(_bc,this.treeLevel,this.treeNodes);
$(_bb).append(_c1.join(""));
function _c2(_c3,_c4,_c5){
var _c6=["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
for(var i=0;i<_c5.length;i++){
var row=_c5[i];
if(row.state!="open"&&row.state!="closed"){
row.state="open";
}
var _c7=_bd.rowStyler?_bd.rowStyler.call(_ba,row):"";
var _c8=_c7?"style=\""+_c7+"\"":"";
var _c9=_bf+"-"+(_c3?1:2)+"-"+row[_bd.idField];
_c6.push("<tr id=\""+_c9+"\" class=\"datagrid-row\" node-id="+row[_bd.idField]+" "+_c8+">");
_c6=_c6.concat(_c0.renderRow.call(_c0,_ba,_be,_c3,_c4,row));
_c6.push("</tr>");
if(row.children&&row.children.length){
var tt=_c2(_c3,_c4+1,row.children);
var v=row.state=="closed"?"none":"block";
_c6.push("<tr class=\"treegrid-tr-tree\"><td style=\"border:0px\" colspan="+(_be.length+(_bd.rownumbers?1:0))+"><div style=\"display:"+v+"\">");
_c6=_c6.concat(tt);
_c6.push("</div></td></tr>");
}
}
_c6.push("</tbody></table>");
return _c6;
};
},renderFooter:function(_ca,_cb,_cc){
var _cd=$.data(_ca,"treegrid").options;
var _ce=$.data(_ca,"treegrid").footer||[];
var _cf=$(_ca).datagrid("getColumnFields",_cc);
var _d0=["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
for(var i=0;i<_ce.length;i++){
var row=_ce[i];
row[_cd.idField]=row[_cd.idField]||("foot-row-id"+i);
_d0.push("<tr class=\"datagrid-row\" node-id="+row[_cd.idField]+">");
_d0.push(this.renderRow.call(this,_ca,_cf,_cc,0,row));
_d0.push("</tr>");
}
_d0.push("</tbody></table>");
$(_cb).html(_d0.join(""));
},renderRow:function(_d1,_d2,_d3,_d4,row){
var _d5=$.data(_d1,"treegrid").options;
var cc=[];
if(_d3&&_d5.rownumbers){
cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">0</div></td>");
}
for(var i=0;i<_d2.length;i++){
var _d6=_d2[i];
var col=$(_d1).datagrid("getColumnOption",_d6);
if(col){
var _d7=col.styler?(col.styler(row[_d6],row)||""):"";
var _d8=col.hidden?"style=\"display:none;"+_d7+"\"":(_d7?"style=\""+_d7+"\"":"");
cc.push("<td field=\""+_d6+"\" "+_d8+">");
if(col.checkbox){
var _d8="";
}else{
var _d8="";
if(col.align){
_d8+="text-align:"+col.align+";";
}
if(!_d5.nowrap){
_d8+="white-space:normal;height:auto;";
}else{
if(_d5.autoRowHeight){
_d8+="height:auto;";
}
}
}
cc.push("<div style=\""+_d8+"\" ");
if(col.checkbox){
cc.push("class=\"datagrid-cell-check ");
}else{
cc.push("class=\"datagrid-cell "+col.cellClass);
}
cc.push("\">");
if(col.checkbox){
if(row.checked){
cc.push("<input type=\"checkbox\" checked=\"checked\"");
}else{
cc.push("<input type=\"checkbox\"");
}
cc.push(" name=\""+_d6+"\" value=\""+(row[_d6]!=undefined?row[_d6]:"")+"\"/>");
}else{
var val=null;
if(col.formatter){
val=col.formatter(row[_d6],row);
}else{
val=row[_d6];
}
if(_d6==_d5.treeField){
for(var j=0;j<_d4;j++){
cc.push("<span class=\"tree-indent\"></span>");
}
if(row.state=="closed"){
cc.push("<span class=\"tree-hit tree-collapsed\"></span>");
cc.push("<span class=\"tree-icon tree-folder "+(row.iconCls?row.iconCls:"")+"\"></span>");
}else{
if(row.children&&row.children.length){
cc.push("<span class=\"tree-hit tree-expanded\"></span>");
cc.push("<span class=\"tree-icon tree-folder tree-folder-open "+(row.iconCls?row.iconCls:"")+"\"></span>");
}else{
cc.push("<span class=\"tree-indent\"></span>");
cc.push("<span class=\"tree-icon tree-file "+(row.iconCls?row.iconCls:"")+"\"></span>");
}
}
cc.push("<span class=\"tree-title\">"+val+"</span>");
}else{
cc.push(val);
}
}
cc.push("</div>");
cc.push("</td>");
}
}
return cc.join("");
},refreshRow:function(_d9,id){
this.updateRow.call(this,_d9,id,{});
},updateRow:function(_da,id,row){
var _db=$.data(_da,"treegrid").options;
var _dc=$(_da).treegrid("find",id);
$.extend(_dc,row);
var _dd=$(_da).treegrid("getLevel",id)-1;
var _de=_db.rowStyler?_db.rowStyler.call(_da,_dc):"";
function _df(_e0){
var _e1=$(_da).treegrid("getColumnFields",_e0);
var tr=_db.finder.getTr(_da,id,"body",(_e0?1:2));
var _e2=tr.find("div.datagrid-cell-rownumber").html();
var _e3=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
tr.html(this.renderRow(_da,_e1,_e0,_dd,_dc));
tr.attr("style",_de||"");
tr.find("div.datagrid-cell-rownumber").html(_e2);
if(_e3){
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true);
}
};
_df.call(this,true);
_df.call(this,false);
$(_da).treegrid("fixRowHeight",id);
},onBeforeRender:function(_e4,_e5,_e6){
if(!_e6){
return false;
}
var _e7=$.data(_e4,"treegrid").options;
if(_e6.length==undefined){
if(_e6.footer){
$.data(_e4,"treegrid").footer=_e6.footer;
}
if(_e6.total){
$.data(_e4,"treegrid").total=_e6.total;
}
_e6=this.transfer(_e4,_e5,_e6.rows);
}else{
function _e8(_e9,_ea){
for(var i=0;i<_e9.length;i++){
var row=_e9[i];
row._parentId=_ea;
if(row.children&&row.children.length){
_e8(row.children,row[_e7.idField]);
}
}
};
_e8(_e6,_e5);
}
var _eb=_41(_e4,_e5);
if(_eb){
if(_eb.children){
_eb.children=_eb.children.concat(_e6);
}else{
_eb.children=_e6;
}
}else{
$.data(_e4,"treegrid").data=$.data(_e4,"treegrid").data.concat(_e6);
}
if(!_e7.remoteSort){
this.sort(_e4,_e6);
}
this.treeNodes=_e6;
this.treeLevel=$(_e4).treegrid("getLevel",_e5);
},sort:function(_ec,_ed){
var _ee=$.data(_ec,"treegrid").options;
var opt=$(_ec).treegrid("getColumnOption",_ee.sortName);
if(opt){
var _ef=opt.sorter||function(a,b){
return (a>b?1:-1);
};
_f0(_ed);
}
function _f0(_f1){
_f1.sort(function(r1,r2){
return _ef(r1[_ee.sortName],r2[_ee.sortName])*(_ee.sortOrder=="asc"?1:-1);
});
for(var i=0;i<_f1.length;i++){
var _f2=_f1[i].children;
if(_f2&&_f2.length){
_f0(_f2);
}
}
};
},transfer:function(_f3,_f4,_f5){
var _f6=$.data(_f3,"treegrid").options;
var _f7=[];
for(var i=0;i<_f5.length;i++){
_f7.push(_f5[i]);
}
var _f8=[];
for(var i=0;i<_f7.length;i++){
var row=_f7[i];
if(!_f4){
if(!row._parentId){
_f8.push(row);
_3(_f7,row);
i--;
}
}else{
if(row._parentId==_f4){
_f8.push(row);
_3(_f7,row);
i--;
}
}
}
var _f9=[];
for(var i=0;i<_f8.length;i++){
_f9.push(_f8[i]);
}
while(_f9.length){
var _fa=_f9.shift();
for(var i=0;i<_f7.length;i++){
var row=_f7[i];
if(row._parentId==_fa[_f6.idField]){
if(_fa.children){
_fa.children.push(row);
}else{
_fa.children=[row];
}
_f9.push(row);
_3(_f7,row);
i--;
}
}
}
return _f8;
}});
$.fn.treegrid.defaults=$.extend({},$.fn.datagrid.defaults,{treeField:null,animate:false,singleSelect:true,view:_b9,loader:function(_fb,_fc,_fd){
var _fe=$(this).treegrid("options");
if(!_fe.url){
return false;
}
$.ajax({type:_fe.method,url:_fe.url,data:_fb,dataType:"json",success:function(_ff){
_fc(_ff);
},error:function(){
_fd.apply(this,arguments);
}});
},loadFilter:function(data,_100){
return data;
},finder:{getTr:function(_101,id,type,_102){
type=type||"body";
_102=_102||0;
var dc=$.data(_101,"datagrid").dc;
if(_102==0){
var opts=$.data(_101,"treegrid").options;
var tr1=opts.finder.getTr(_101,id,type,1);
var tr2=opts.finder.getTr(_101,id,type,2);
return tr1.add(tr2);
}else{
if(type=="body"){
var tr=$("#"+$.data(_101,"datagrid").rowIdPrefix+"-"+_102+"-"+id);
if(!tr.length){
tr=(_102==1?dc.body1:dc.body2).find("tr[node-id="+id+"]");
}
return tr;
}else{
if(type=="footer"){
return (_102==1?dc.footer1:dc.footer2).find("tr[node-id="+id+"]");
}else{
if(type=="selected"){
return (_102==1?dc.body1:dc.body2).find("tr.datagrid-row-selected");
}else{
if(type=="last"){
return (_102==1?dc.body1:dc.body2).find("tr:last[node-id]");
}else{
if(type=="allbody"){
return (_102==1?dc.body1:dc.body2).find("tr[node-id]");
}else{
if(type=="allfooter"){
return (_102==1?dc.footer1:dc.footer2).find("tr[node-id]");
}
}
}
}
}
}
}
},getRow:function(_103,p){
var id=(typeof p=="object")?p.attr("node-id"):p;
return $(_103).treegrid("find",id);
}},onBeforeLoad:function(row,_104){
},onLoadSuccess:function(row,data){
},onLoadError:function(){
},onBeforeCollapse:function(row){
},onCollapse:function(row){
},onBeforeExpand:function(row){
},onExpand:function(row){
},onClickRow:function(row){
},onDblClickRow:function(row){
},onClickCell:function(_105,row){
},onDblClickCell:function(_106,row){
},onContextMenu:function(e,row){
},onBeforeEdit:function(row){
},onAfterEdit:function(row,_107){
},onCancelEdit:function(row){
}});
})(jQuery);

