/**
 * 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($){
var _1=0;
function _2(a,o){
for(var i=0,_3=a.length;i<_3;i++){
if(a[i]==o){
return i;
}
}
return -1;
};
function _4(a,o,id){
if(typeof o=="string"){
for(var i=0,_5=a.length;i<_5;i++){
if(a[i][o]==id){
a.splice(i,1);
return;
}
}
}else{
var _6=_2(a,o);
if(_6!=-1){
a.splice(_6,1);
}
}
};
function _7(a,o,r){
for(var i=0,_8=a.length;i<_8;i++){
if(a[i][o]==r[o]){
return;
}
}
a.push(r);
};
function _9(_a,_b){
var _c=$.data(_a,"datagrid").options;
var _d=$.data(_a,"datagrid").panel;
if(_b){
if(_b.width){
_c.width=_b.width;
}
if(_b.height){
_c.height=_b.height;
}
}
if(_c.fit==true){
var p=_d.panel("panel").parent();
_c.width=p.width();
_c.height=p.height();
}
_d.panel("resize",{width:_c.width,height:_c.height});
};
function _e(_f){
var _10=$.data(_f,"datagrid").options;
var dc=$.data(_f,"datagrid").dc;
var _11=$.data(_f,"datagrid").panel;
var _12=_11.width();
var _13=_11.height();
var _14=dc.view;
var _15=dc.view1;
var _16=dc.view2;
var _17=_15.children("div.datagrid-header");
var _18=_16.children("div.datagrid-header");
var _19=_17.find("table");
var _1a=_18.find("table");
_14.width(_12);
var _1b=_17.children("div.datagrid-header-inner").show();
_15.width(_1b.find("table").width());
if(!_10.showHeader){
_1b.hide();
}
_16.width(_12-_15._outerWidth());
_15.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_15.width());
_16.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_16.width());
var hh;
_17.css("height","");
_18.css("height","");
_19.css("height","");
_1a.css("height","");
hh=Math.max(_19.height(),_1a.height());
_19.height(hh);
_1a.height(hh);
_17.add(_18)._outerHeight(hh);
if(_10.height!="auto"){
var _1c=_13-_16.children("div.datagrid-header")._outerHeight()-_16.children("div.datagrid-footer")._outerHeight()-_11.children("div.datagrid-toolbar")._outerHeight();
_11.children("div.datagrid-pager").each(function(){
_1c-=$(this)._outerHeight();
});
dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({position:"absolute",top:dc.header2._outerHeight()});
var _1d=dc.body2.children("table.datagrid-btable-frozen")._outerHeight();
_15.add(_16).children("div.datagrid-body").css({marginTop:_1d,height:(_1c-_1d)});
}
_14.height(_16.height());
};
function _1e(_1f,_20,_21){
var _22=$.data(_1f,"datagrid").data.rows;
var _23=$.data(_1f,"datagrid").options;
var dc=$.data(_1f,"datagrid").dc;
if(!dc.body1.is(":empty")&&(!_23.nowrap||_23.autoRowHeight||_21)){
if(_20!=undefined){
var tr1=_23.finder.getTr(_1f,_20,"body",1);
var tr2=_23.finder.getTr(_1f,_20,"body",2);
_24(tr1,tr2);
}else{
var tr1=_23.finder.getTr(_1f,0,"allbody",1);
var tr2=_23.finder.getTr(_1f,0,"allbody",2);
_24(tr1,tr2);
if(_23.showFooter){
var tr1=_23.finder.getTr(_1f,0,"allfooter",1);
var tr2=_23.finder.getTr(_1f,0,"allfooter",2);
_24(tr1,tr2);
}
}
}
_e(_1f);
if(_23.height=="auto"){
var _25=dc.body1.parent();
var _26=dc.body2;
var _27=0;
var _28=0;
_26.children().each(function(){
var c=$(this);
if(c.is(":visible")){
_27+=c._outerHeight();
if(_28<c._outerWidth()){
_28=c._outerWidth();
}
}
});
if(_28>_26.width()){
_27+=18;
}
_25.height(_27);
_26.height(_27);
dc.view.height(dc.view2.height());
}
dc.body2.triggerHandler("scroll");
function _24(_29,_2a){
for(var i=0;i<_2a.length;i++){
var tr1=$(_29[i]);
var tr2=$(_2a[i]);
tr1.css("height","");
tr2.css("height","");
var _2b=Math.max(tr1.height(),tr2.height());
tr1.css("height",_2b);
tr2.css("height",_2b);
}
};
};
function _2c(_2d,_2e){
var _2f=$.data(_2d,"datagrid");
var _30=_2f.options;
var dc=_2f.dc;
if(!dc.body2.children("table.datagrid-btable-frozen").length){
dc.body1.add(dc.body2).prepend("<table class=\"datagrid-btable datagrid-btable-frozen\" cellspacing=\"0\" cellpadding=\"0\"></table>");
}
_31(true);
_31(false);
_e(_2d);
function _31(_32){
var _33=_32?1:2;
var tr=_30.finder.getTr(_2d,_2e,"body",_33);
(_32?dc.body1:dc.body2).children("table.datagrid-btable-frozen").append(tr);
};
};
function _34(_35,_36){
function _37(){
var _38=[];
var _39=[];
$(_35).children("thead").each(function(){
var opt=$.parser.parseOptions(this,[{frozen:"boolean"}]);
$(this).find("tr").each(function(){
var _3a=[];
$(this).find("th").each(function(){
var th=$(this);
var col=$.extend({},$.parser.parseOptions(this,["field","align","halign","order",{sortable:"boolean",checkbox:"boolean",resizable:"boolean"},{rowspan:"number",colspan:"number",width:"number"}]),{title:(th.html()||undefined),hidden:(th.attr("hidden")?true:undefined),formatter:(th.attr("formatter")?eval(th.attr("formatter")):undefined),styler:(th.attr("styler")?eval(th.attr("styler")):undefined),sorter:(th.attr("sorter")?eval(th.attr("sorter")):undefined)});
if(th.attr("editor")){
var s=$.trim(th.attr("editor"));
if(s.substr(0,1)=="{"){
col.editor=eval("("+s+")");
}else{
col.editor=s;
}
}
_3a.push(col);
});
opt.frozen?_38.push(_3a):_39.push(_3a);
});
});
return [_38,_39];
};
var _3b=$("<div class=\"datagrid-wrap\">"+"<div class=\"datagrid-view\">"+"<div class=\"datagrid-view1\">"+"<div class=\"datagrid-header\">"+"<div class=\"datagrid-header-inner\"></div>"+"</div>"+"<div class=\"datagrid-body\">"+"<div class=\"datagrid-body-inner\"></div>"+"</div>"+"<div class=\"datagrid-footer\">"+"<div class=\"datagrid-footer-inner\"></div>"+"</div>"+"</div>"+"<div class=\"datagrid-view2\">"+"<div class=\"datagrid-header\">"+"<div class=\"datagrid-header-inner\"></div>"+"</div>"+"<div class=\"datagrid-body\"></div>"+"<div class=\"datagrid-footer\">"+"<div class=\"datagrid-footer-inner\"></div>"+"</div>"+"</div>"+"</div>"+"</div>").insertAfter(_35);
_3b.panel({doSize:false});
_3b.panel("panel").addClass("datagrid").bind("_resize",function(e,_3c){
var _3d=$.data(_35,"datagrid").options;
if(_3d.fit==true||_3c){
_9(_35);
setTimeout(function(){
if($.data(_35,"datagrid")){
_3e(_35);
}
},0);
}
return false;
});
$(_35).hide().appendTo(_3b.children("div.datagrid-view"));
var cc=_37();
var _3f=_3b.children("div.datagrid-view");
var _40=_3f.children("div.datagrid-view1");
var _41=_3f.children("div.datagrid-view2");
return {panel:_3b,frozenColumns:cc[0],columns:cc[1],dc:{view:_3f,view1:_40,view2:_41,header1:_40.children("div.datagrid-header").children("div.datagrid-header-inner"),header2:_41.children("div.datagrid-header").children("div.datagrid-header-inner"),body1:_40.children("div.datagrid-body").children("div.datagrid-body-inner"),body2:_41.children("div.datagrid-body"),footer1:_40.children("div.datagrid-footer").children("div.datagrid-footer-inner"),footer2:_41.children("div.datagrid-footer").children("div.datagrid-footer-inner")}};
};
function _42(_43){
var _44={total:0,rows:[]};
var _45=_46(_43,true).concat(_46(_43,false));
$(_43).find("tbody tr").each(function(){
_44.total++;
var col={};
for(var i=0;i<_45.length;i++){
col[_45[i]]=$("td:eq("+i+")",this).html();
}
_44.rows.push(col);
});
return _44;
};
function _47(_48){
var _49=$.data(_48,"datagrid");
var _4a=_49.options;
var dc=_49.dc;
var _4b=_49.panel;
_4b.panel($.extend({},_4a,{id:null,doSize:false,onResize:function(_4c,_4d){
setTimeout(function(){
if($.data(_48,"datagrid")){
_e(_48);
_73(_48);
_4a.onResize.call(_4b,_4c,_4d);
}
},0);
},onExpand:function(){
_1e(_48);
_4a.onExpand.call(_4b);
}}));
_49.rowIdPrefix="datagrid-row-r"+(++_1);
_4e(dc.header1,_4a.frozenColumns,true);
_4e(dc.header2,_4a.columns,false);
_4f();
dc.header1.add(dc.header2).css("display",_4a.showHeader?"block":"none");
dc.footer1.add(dc.footer2).css("display",_4a.showFooter?"block":"none");
if(_4a.toolbar){
if(typeof _4a.toolbar=="string"){
$(_4a.toolbar).addClass("datagrid-toolbar").prependTo(_4b);
$(_4a.toolbar).show();
}else{
$("div.datagrid-toolbar",_4b).remove();
var tb=$("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_4b);
var tr=tb.find("tr");
for(var i=0;i<_4a.toolbar.length;i++){
var btn=_4a.toolbar[i];
if(btn=="-"){
$("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr);
}else{
var td=$("<td></td>").appendTo(tr);
var _50=$("<a href=\"javascript:void(0)\"></a>").appendTo(td);
_50[0].onclick=eval(btn.handler||function(){
});
_50.linkbutton($.extend({},btn,{plain:true}));
}
}
}
}else{
$("div.datagrid-toolbar",_4b).remove();
}
$("div.datagrid-pager",_4b).remove();
if(_4a.pagination){
var _51=$("<div class=\"datagrid-pager\"></div>");
if(_4a.pagePosition=="bottom"){
_51.appendTo(_4b);
}else{
if(_4a.pagePosition=="top"){
_51.addClass("datagrid-pager-top").prependTo(_4b);
}else{
var _52=$("<div class=\"datagrid-pager datagrid-pager-top\"></div>").prependTo(_4b);
_51.appendTo(_4b);
_51=_51.add(_52);
}
}
_51.pagination({total:0,pageNumber:_4a.pageNumber,pageSize:_4a.pageSize,pageList:_4a.pageList,onSelectPage:function(_53,_54){
_4a.pageNumber=_53;
_4a.pageSize=_54;
_51.pagination("refresh",{pageNumber:_53,pageSize:_54});
_150(_48);
}});
_4a.pageSize=_51.pagination("options").pageSize;
}
function _4e(_55,_56,_57){
if(!_56){
return;
}
$(_55).show();
$(_55).empty();
var t=$("<table class=\"datagrid-htable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>").appendTo(_55);
for(var i=0;i<_56.length;i++){
var tr=$("<tr class=\"datagrid-header-row\"></tr>").appendTo($("tbody",t));
var _58=_56[i];
for(var j=0;j<_58.length;j++){
var col=_58[j];
var _59="";
if(col.rowspan){
_59+="rowspan=\""+col.rowspan+"\" ";
}
if(col.colspan){
_59+="colspan=\""+col.colspan+"\" ";
}
var td=$("<td "+_59+"></td>").appendTo(tr);
if(col.checkbox){
td.attr("field",col.field);
$("<div class=\"datagrid-header-check\"></div>").html("<input type=\"checkbox\"/>").appendTo(td);
}else{
if(col.field){
td.attr("field",col.field);
td.append("<div class=\"datagrid-cell\"><span></span><span class=\"datagrid-sort-icon\"></span></div>");
$("span",td).html(col.title);
$("span.datagrid-sort-icon",td).html("&nbsp;");
var _5a=td.find("div.datagrid-cell");
if(col.resizable==false){
_5a.attr("resizable","false");
}
if(col.width){
_5a._outerWidth(col.width);
col.boxWidth=parseInt(_5a[0].style.width);
}else{
col.auto=true;
}
_5a.css("text-align",(col.halign||col.align||""));
col.cellClass="datagrid-cell-c"+_1+"-"+col.field.replace(/\./g,"-");
col.cellSelector="div."+col.cellClass;
}else{
$("<div class=\"datagrid-cell-group\"></div>").html(col.title).appendTo(td);
}
}
if(col.hidden){
td.hide();
}
}
}
if(_57&&_4a.rownumbers){
var td=$("<td rowspan=\""+_4a.frozenColumns.length+"\"><div class=\"datagrid-header-rownumber\"></div></td>");
if($("tr",t).length==0){
td.wrap("<tr class=\"datagrid-header-row\"></tr>").parent().appendTo($("tbody",t));
}else{
td.prependTo($("tr:first",t));
}
}
};
function _4f(){
var ss=["<style type=\"text/css\">"];
var _5b=_46(_48,true).concat(_46(_48));
for(var i=0;i<_5b.length;i++){
var col=_5c(_48,_5b[i]);
if(col&&!col.checkbox){
ss.push(col.cellSelector+" {width:"+col.boxWidth+"px;}");
}
}
ss.push("</style>");
$(ss.join("\n")).prependTo(dc.view);
};
};
function _5d(_5e){
var _5f=$.data(_5e,"datagrid");
var _60=_5f.panel;
var _61=_5f.options;
var dc=_5f.dc;
var _62=dc.header1.add(dc.header2);
_62.find("input[type=checkbox]").unbind(".datagrid").bind("click.datagrid",function(e){
if(_61.singleSelect&&_61.selectOnCheck){
return false;
}
if($(this).is(":checked")){
_e5(_5e);
}else{
_ed(_5e);
}
e.stopPropagation();
});
var _63=_62.find("div.datagrid-cell");
_63.closest("td").unbind(".datagrid").bind("mouseenter.datagrid",function(){
if(_5f.resizing){
return;
}
$(this).addClass("datagrid-header-over");
}).bind("mouseleave.datagrid",function(){
$(this).removeClass("datagrid-header-over");
}).bind("contextmenu.datagrid",function(e){
var _64=$(this).attr("field");
_61.onHeaderContextMenu.call(_5e,e,_64);
});
_63.unbind(".datagrid").bind("click.datagrid",function(e){
var p1=$(this).offset().left+5;
var p2=$(this).offset().left+$(this)._outerWidth()-5;
if(e.pageX<p2&&e.pageX>p1){
var _65=$(this).parent().attr("field");
var col=_5c(_5e,_65);
if(!col.sortable||_5f.resizing){
return;
}
_61.sortName=_65;
_61.sortOrder=col.order||"asc";
var cls="datagrid-sort-"+_61.sortOrder;
if($(this).hasClass("datagrid-sort-asc")){
cls="datagrid-sort-desc";
_61.sortOrder="desc";
}else{
if($(this).hasClass("datagrid-sort-desc")){
cls="datagrid-sort-asc";
_61.sortOrder="asc";
}
}
_63.removeClass("datagrid-sort-asc datagrid-sort-desc");
$(this).addClass(cls);
if(_61.remoteSort){
_150(_5e);
}else{
var _66=$.data(_5e,"datagrid").data;
_ab(_5e,_66);
}
_61.onSortColumn.call(_5e,_61.sortName,_61.sortOrder);
}
}).bind("dblclick.datagrid",function(e){
var p1=$(this).offset().left+5;
var p2=$(this).offset().left+$(this)._outerWidth()-5;
var _67=_61.resizeHandle=="right"?(e.pageX>p2):(_61.resizeHandle=="left"?(e.pageX<p1):(e.pageX<p1||e.pageX>p2));
if(_67){
var _68=$(this).parent().attr("field");
var col=_5c(_5e,_68);
if(col.resizable==false){
return;
}
$(_5e).datagrid("autoSizeColumn",_68);
col.auto=false;
}
});
var _69=_61.resizeHandle=="right"?"e":(_61.resizeHandle=="left"?"w":"e,w");
_63.each(function(){
$(this).resizable({handles:_69,disabled:($(this).attr("resizable")?$(this).attr("resizable")=="false":false),minWidth:25,onStartResize:function(e){
_5f.resizing=true;
_62.css("cursor",$("body").css("cursor"));
if(!_5f.proxy){
_5f.proxy=$("<div class=\"datagrid-resize-proxy\"></div>").appendTo(dc.view);
}
_5f.proxy.css({left:e.pageX-$(_60).offset().left-1,display:"none"});
setTimeout(function(){
if(_5f.proxy){
_5f.proxy.show();
}
},500);
},onResize:function(e){
_5f.proxy.css({left:e.pageX-$(_60).offset().left-1,display:"block"});
return false;
},onStopResize:function(e){
_62.css("cursor","");
var _6a=$(this).parent().attr("field");
var col=_5c(_5e,_6a);
col.width=$(this)._outerWidth();
col.boxWidth=parseInt(this.style.width);
col.auto=undefined;
_3e(_5e,_6a);
_5f.proxy.remove();
_5f.proxy=null;
if($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")){
_e(_5e);
}
_73(_5e);
_61.onResizeColumn.call(_5e,_6a,col.width);
setTimeout(function(){
_5f.resizing=false;
},0);
}});
});
dc.body1.add(dc.body2).unbind().bind("mouseover",function(e){
if(_5f.resizing){
return;
}
var tr=$(e.target).closest("tr.datagrid-row");
if(!tr.length){
return;
}
var _6b=_6c(tr);
_61.finder.getTr(_5e,_6b).addClass("datagrid-row-over");
e.stopPropagation();
}).bind("mouseout",function(e){
var tr=$(e.target).closest("tr.datagrid-row");
if(!tr.length){
return;
}
var _6d=_6c(tr);
_61.finder.getTr(_5e,_6d).removeClass("datagrid-row-over");
e.stopPropagation();
}).bind("click",function(e){
var tt=$(e.target);
var tr=tt.closest("tr.datagrid-row");
if(!tr.length){
return;
}
var _6e=_6c(tr);
if(tt.parent().hasClass("datagrid-cell-check")){
if(_61.singleSelect&&_61.selectOnCheck){
if(!_61.checkOnSelect){
_ed(_5e,true);
}
_d2(_5e,_6e);
}else{
if(tt.is(":checked")){
_d2(_5e,_6e);
}else{
_dd(_5e,_6e);
}
}
}else{
var row=_61.finder.getRow(_5e,_6e);
var td=tt.closest("td[field]",tr);
if(td.length){
var _6f=td.attr("field");
_61.onClickCell.call(_5e,_6e,_6f,row[_6f]);
}
if(_61.singleSelect==true){
_ca(_5e,_6e);
}else{
if(tr.hasClass("datagrid-row-selected")){
_d6(_5e,_6e);
}else{
_ca(_5e,_6e);
}
}
_61.onClickRow.call(_5e,_6e,row);
}
e.stopPropagation();
}).bind("dblclick",function(e){
var tt=$(e.target);
var tr=tt.closest("tr.datagrid-row");
if(!tr.length){
return;
}
var _70=_6c(tr);
var row=_61.finder.getRow(_5e,_70);
var td=tt.closest("td[field]",tr);
if(td.length){
var _71=td.attr("field");
_61.onDblClickCell.call(_5e,_70,_71,row[_71]);
}
_61.onDblClickRow.call(_5e,_70,row);
e.stopPropagation();
}).bind("contextmenu",function(e){
var tr=$(e.target).closest("tr.datagrid-row");
if(!tr.length){
return;
}
var _72=_6c(tr);
var row=_61.finder.getRow(_5e,_72);
_61.onRowContextMenu.call(_5e,e,_72,row);
e.stopPropagation();
});
dc.body2.bind("scroll",function(){
dc.view1.children("div.datagrid-body").scrollTop($(this).scrollTop());
dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft());
dc.body2.children("table.datagrid-btable-frozen").css("left",-$(this)._scrollLeft());
});
function _6c(tr){
if(tr.attr("datagrid-row-index")){
return parseInt(tr.attr("datagrid-row-index"));
}else{
return tr.attr("node-id");
}
};
};
function _73(_74){
var _75=$.data(_74,"datagrid").options;
var dc=$.data(_74,"datagrid").dc;
if(!_75.fitColumns){
return;
}
var _76=dc.view2.children("div.datagrid-header");
var _77=0;
var _78;
var _79=_46(_74,false);
for(var i=0;i<_79.length;i++){
var col=_5c(_74,_79[i]);
if(_7a(col)){
_77+=col.width;
_78=col;
}
}
var _7b=_76.children("div.datagrid-header-inner").show();
var _7c=_76.width()-_76.find("table").width()-_75.scrollbarSize;
var _7d=_7c/_77;
if(!_75.showHeader){
_7b.hide();
}
for(var i=0;i<_79.length;i++){
var col=_5c(_74,_79[i]);
if(_7a(col)){
var _7e=Math.floor(col.width*_7d);
_7f(col,_7e);
_7c-=_7e;
}
}
if(_7c&&_78){
_7f(_78,_7c);
}
_3e(_74);
function _7f(col,_80){
col.width+=_80;
col.boxWidth+=_80;
_76.find("td[field=\""+col.field+"\"] div.datagrid-cell").width(col.boxWidth);
};
function _7a(col){
if(!col.hidden&&!col.checkbox&&!col.auto){
return true;
}
};
};
function _81(_82,_83){
var _84=$.data(_82,"datagrid").options;
var dc=$.data(_82,"datagrid").dc;
if(_83){
_9(_83);
if(_84.fitColumns){
_e(_82);
_73(_82);
}
}else{
var _85=false;
var _86=_46(_82,true).concat(_46(_82,false));
for(var i=0;i<_86.length;i++){
var _83=_86[i];
var col=_5c(_82,_83);
if(col.auto){
_9(_83);
_85=true;
}
}
if(_85&&_84.fitColumns){
_e(_82);
_73(_82);
}
}
function _9(_87){
var _88=dc.view.find("div.datagrid-header td[field=\""+_87+"\"] div.datagrid-cell");
_88.css("width","");
var col=$(_82).datagrid("getColumnOption",_87);
col.width=undefined;
col.boxWidth=undefined;
col.auto=true;
$(_82).datagrid("fixColumnSize",_87);
var _89=Math.max(_88._outerWidth(),_8a("allbody"),_8a("allfooter"));
_88._outerWidth(_89);
col.width=_89;
col.boxWidth=parseInt(_88[0].style.width);
$(_82).datagrid("fixColumnSize",_87);
_84.onResizeColumn.call(_82,_87,col.width);
function _8a(_8b){
var _8c=0;
_84.finder.getTr(_82,0,_8b).find("td[field=\""+_87+"\"] div.datagrid-cell").each(function(){
var w=$(this)._outerWidth();
if(_8c<w){
_8c=w;
}
});
return _8c;
};
};
};
function _3e(_8d,_8e){
var _8f=$.data(_8d,"datagrid").options;
var dc=$.data(_8d,"datagrid").dc;
var _90=dc.view.find("table.datagrid-btable,table.datagrid-ftable");
_90.css("table-layout","fixed");
if(_8e){
fix(_8e);
}else{
var ff=_46(_8d,true).concat(_46(_8d,false));
for(var i=0;i<ff.length;i++){
fix(ff[i]);
}
}
_90.css("table-layout","auto");
_91(_8d);
setTimeout(function(){
_1e(_8d);
_9a(_8d);
},0);
function fix(_92){
var col=_5c(_8d,_92);
if(col.checkbox){
return;
}
var _93=dc.view.children("style")[0];
var _94=_93.styleSheet?_93.styleSheet:(_93.sheet||document.styleSheets[document.styleSheets.length-1]);
var _95=_94.cssRules||_94.rules;
for(var i=0,len=_95.length;i<len;i++){
var _96=_95[i];
if(_96.selectorText.toLowerCase()==col.cellSelector.toLowerCase()){
_96.style["width"]=col.boxWidth?col.boxWidth+"px":"auto";
break;
}
}
};
};
function _91(_97){
var dc=$.data(_97,"datagrid").dc;
dc.body1.add(dc.body2).find("td.datagrid-td-merged").each(function(){
var td=$(this);
var _98=td.attr("colspan")||1;
var _99=_5c(_97,td.attr("field")).width;
for(var i=1;i<_98;i++){
td=td.next();
_99+=_5c(_97,td.attr("field")).width+1;
}
$(this).children("div.datagrid-cell")._outerWidth(_99);
});
};
function _9a(_9b){
var dc=$.data(_9b,"datagrid").dc;
dc.view.find("div.datagrid-editable").each(function(){
var _9c=$(this);
var _9d=_9c.parent().attr("field");
var col=$(_9b).datagrid("getColumnOption",_9d);
_9c._outerWidth(col.width);
var ed=$.data(this,"datagrid.editor");
if(ed.actions.resize){
ed.actions.resize(ed.target,_9c.width());
}
});
};
function _5c(_9e,_9f){
function _a0(_a1){
if(_a1){
for(var i=0;i<_a1.length;i++){
var cc=_a1[i];
for(var j=0;j<cc.length;j++){
var c=cc[j];
if(c.field==_9f){
return c;
}
}
}
}
return null;
};
var _a2=$.data(_9e,"datagrid").options;
var col=_a0(_a2.columns);
if(!col){
col=_a0(_a2.frozenColumns);
}
return col;
};
function _46(_a3,_a4){
var _a5=$.data(_a3,"datagrid").options;
var _a6=(_a4==true)?(_a5.frozenColumns||[[]]):_a5.columns;
if(_a6.length==0){
return [];
}
var _a7=[];
function _a8(_a9){
var c=0;
var i=0;
while(true){
if(_a7[i]==undefined){
if(c==_a9){
return i;
}
c++;
}
i++;
}
};
function _aa(r){
var ff=[];
var c=0;
for(var i=0;i<_a6[r].length;i++){
var col=_a6[r][i];
if(col.field){
ff.push([c,col.field]);
}
c+=parseInt(col.colspan||"1");
}
for(var i=0;i<ff.length;i++){
ff[i][0]=_a8(ff[i][0]);
}
for(var i=0;i<ff.length;i++){
var f=ff[i];
_a7[f[0]]=f[1];
}
};
for(var i=0;i<_a6.length;i++){
_aa(i);
}
return _a7;
};
function _ab(_ac,_ad){
var _ae=$.data(_ac,"datagrid");
var _af=_ae.options;
var dc=_ae.dc;
_ad=_af.loadFilter.call(_ac,_ad);
_ad.total=parseInt(_ad.total);
_ae.data=_ad;
if(_ad.footer){
_ae.footer=_ad.footer;
}
if(!_af.remoteSort){
var opt=_5c(_ac,_af.sortName);
if(opt){
var _b0=opt.sorter||function(a,b){
return (a>b?1:-1);
};
_ad.rows.sort(function(r1,r2){
return _b0(r1[_af.sortName],r2[_af.sortName])*(_af.sortOrder=="asc"?1:-1);
});
}
}
if(_af.view.onBeforeRender){
_af.view.onBeforeRender.call(_af.view,_ac,_ad.rows);
}
_af.view.render.call(_af.view,_ac,dc.body2,false);
_af.view.render.call(_af.view,_ac,dc.body1,true);
if(_af.showFooter){
_af.view.renderFooter.call(_af.view,_ac,dc.footer2,false);
_af.view.renderFooter.call(_af.view,_ac,dc.footer1,true);
}
if(_af.view.onAfterRender){
_af.view.onAfterRender.call(_af.view,_ac);
}
dc.view.children("style:gt(0)").remove();
_af.onLoadSuccess.call(_ac,_ad);
var _b1=$(_ac).datagrid("getPager");
if(_b1.length){
if(_b1.pagination("options").total!=_ad.total){
_b1.pagination("refresh",{total:_ad.total});
}
}
_1e(_ac);
dc.body2.triggerHandler("scroll");
_b2();
$(_ac).datagrid("autoSizeColumn");
function _b2(){
if(_af.idField){
for(var i=0;i<_ad.rows.length;i++){
var row=_ad.rows[i];
if(_b3(_ae.selectedRows,row)){
_ca(_ac,i,true);
}
if(_b3(_ae.checkedRows,row)){
_d2(_ac,i,true);
}
}
}
function _b3(a,r){
for(var i=0;i<a.length;i++){
if(a[i][_af.idField]==r[_af.idField]){
a[i]=r;
return true;
}
}
return false;
};
};
};
function _b4(_b5,row){
var _b6=$.data(_b5,"datagrid").options;
var _b7=$.data(_b5,"datagrid").data.rows;
if(typeof row=="object"){
return _2(_b7,row);
}else{
for(var i=0;i<_b7.length;i++){
if(_b7[i][_b6.idField]==row){
return i;
}
}
return -1;
}
};
function _b8(_b9){
var _ba=$.data(_b9,"datagrid");
var _bb=_ba.options;
var _bc=_ba.data;
if(_bb.idField){
return _ba.selectedRows;
}else{
var _bd=[];
_bb.finder.getTr(_b9,"","selected",2).each(function(){
var _be=parseInt($(this).attr("datagrid-row-index"));
_bd.push(_bc.rows[_be]);
});
return _bd;
}
};
function _bf(_c0){
var _c1=$.data(_c0,"datagrid");
var _c2=_c1.options;
if(_c2.idField){
return _c1.checkedRows;
}else{
var _c3=[];
_c1.dc.view.find("div.datagrid-cell-check input:checked").each(function(){
var _c4=$(this).closest("tr.datagrid-row").attr("datagrid-row-index");
_c3.push(_c2.finder.getRow(_c0,_c4));
});
return _c3;
}
};
function _c5(_c6,_c7){
var _c8=$.data(_c6,"datagrid").options;
if(_c8.idField){
var _c9=_b4(_c6,_c7);
if(_c9>=0){
_ca(_c6,_c9);
}
}
};
function _ca(_cb,_cc,_cd){
var _ce=$.data(_cb,"datagrid");
var dc=_ce.dc;
var _cf=_ce.options;
var _d0=_ce.selectedRows;
if(_cf.singleSelect){
_d1(_cb);
_d0.splice(0,_d0.length);
}
if(!_cd&&_cf.checkOnSelect){
_d2(_cb,_cc,true);
}
var row=_cf.finder.getRow(_cb,_cc);
if(_cf.idField){
_7(_d0,_cf.idField,row);
}
_cf.onSelect.call(_cb,_cc,row);
var tr=_cf.finder.getTr(_cb,_cc).addClass("datagrid-row-selected");
if(tr.length){
if(tr.closest("table").hasClass("datagrid-btable-frozen")){
return;
}
var _d3=dc.view2.children("div.datagrid-header")._outerHeight();
var _d4=dc.body2;
var _d5=_d4.outerHeight(true)-_d4.outerHeight();
var top=tr.position().top-_d3-_d5;
if(top<0){
_d4.scrollTop(_d4.scrollTop()+top);
}else{
if(top+tr._outerHeight()>_d4.height()-18){
_d4.scrollTop(_d4.scrollTop()+top+tr._outerHeight()-_d4.height()+18);
}
}
}
};
function _d6(_d7,_d8,_d9){
var _da=$.data(_d7,"datagrid");
var dc=_da.dc;
var _db=_da.options;
var _dc=$.data(_d7,"datagrid").selectedRows;
if(!_d9&&_db.checkOnSelect){
_dd(_d7,_d8,true);
}
_db.finder.getTr(_d7,_d8).removeClass("datagrid-row-selected");
var row=_db.finder.getRow(_d7,_d8);
if(_db.idField){
_4(_dc,_db.idField,row[_db.idField]);
}
_db.onUnselect.call(_d7,_d8,row);
};
function _de(_df,_e0){
var _e1=$.data(_df,"datagrid");
var _e2=_e1.options;
var _e3=_e1.data.rows;
var _e4=$.data(_df,"datagrid").selectedRows;
if(!_e0&&_e2.checkOnSelect){
_e5(_df,true);
}
_e2.finder.getTr(_df,"","allbody").addClass("datagrid-row-selected");
if(_e2.idField){
for(var _e6=0;_e6<_e3.length;_e6++){
_7(_e4,_e2.idField,_e3[_e6]);
}
}
_e2.onSelectAll.call(_df,_e3);
};
function _d1(_e7,_e8){
var _e9=$.data(_e7,"datagrid");
var _ea=_e9.options;
var _eb=_e9.data.rows;
var _ec=$.data(_e7,"datagrid").selectedRows;
if(!_e8&&_ea.checkOnSelect){
_ed(_e7,true);
}
_ea.finder.getTr(_e7,"","selected").removeClass("datagrid-row-selected");
if(_ea.idField){
for(var _ee=0;_ee<_eb.length;_ee++){
_4(_ec,_ea.idField,_eb[_ee][_ea.idField]);
}
}
_ea.onUnselectAll.call(_e7,_eb);
};
function _d2(_ef,_f0,_f1){
var _f2=$.data(_ef,"datagrid");
var _f3=_f2.options;
if(!_f1&&_f3.selectOnCheck){
_ca(_ef,_f0,true);
}
var ck=_f3.finder.getTr(_ef,_f0).find("div.datagrid-cell-check input[type=checkbox]");
ck._propAttr("checked",true);
ck=_f3.finder.getTr(_ef,"","allbody").find("div.datagrid-cell-check input[type=checkbox]:not(:checked)");
if(!ck.length){
var dc=_f2.dc;
var _f4=dc.header1.add(dc.header2);
_f4.find("input[type=checkbox]")._propAttr("checked",true);
}
var row=_f3.finder.getRow(_ef,_f0);
if(_f3.idField){
_7(_f2.checkedRows,_f3.idField,row);
}
_f3.onCheck.call(_ef,_f0,row);
};
function _dd(_f5,_f6,_f7){
var _f8=$.data(_f5,"datagrid");
var _f9=_f8.options;
if(!_f7&&_f9.selectOnCheck){
_d6(_f5,_f6,true);
}
var ck=_f9.finder.getTr(_f5,_f6).find("div.datagrid-cell-check input[type=checkbox]");
ck._propAttr("checked",false);
var dc=_f8.dc;
var _fa=dc.header1.add(dc.header2);
_fa.find("input[type=checkbox]")._propAttr("checked",false);
var row=_f9.finder.getRow(_f5,_f6);
if(_f9.idField){
_4(_f8.checkedRows,_f9.idField,row[_f9.idField]);
}
_f9.onUncheck.call(_f5,_f6,row);
};
function _e5(_fb,_fc){
var _fd=$.data(_fb,"datagrid");
var _fe=_fd.options;
var _ff=_fd.data.rows;
if(!_fc&&_fe.selectOnCheck){
_de(_fb,true);
}
var dc=_fd.dc;
var hck=dc.header1.add(dc.header2).find("input[type=checkbox]");
var bck=_fe.finder.getTr(_fb,"","allbody").find("div.datagrid-cell-check input[type=checkbox]");
hck.add(bck)._propAttr("checked",true);
if(_fe.idField){
for(var i=0;i<_ff.length;i++){
_7(_fd.checkedRows,_fe.idField,_ff[i]);
}
}
_fe.onCheckAll.call(_fb,_ff);
};
function _ed(_100,_101){
var _102=$.data(_100,"datagrid");
var opts=_102.options;
var rows=_102.data.rows;
if(!_101&&opts.selectOnCheck){
_d1(_100,true);
}
var dc=_102.dc;
var hck=dc.header1.add(dc.header2).find("input[type=checkbox]");
var bck=opts.finder.getTr(_100,"","allbody").find("div.datagrid-cell-check input[type=checkbox]");
hck.add(bck)._propAttr("checked",false);
if(opts.idField){
for(var i=0;i<rows.length;i++){
_4(_102.checkedRows,opts.idField,rows[i][opts.idField]);
}
}
opts.onUncheckAll.call(_100,rows);
};
function _103(_104,_105){
var opts=$.data(_104,"datagrid").options;
var tr=opts.finder.getTr(_104,_105);
var row=opts.finder.getRow(_104,_105);
if(tr.hasClass("datagrid-row-editing")){
return;
}
if(opts.onBeforeEdit.call(_104,_105,row)==false){
return;
}
tr.addClass("datagrid-row-editing");
_106(_104,_105);
_9a(_104);
tr.find("div.datagrid-editable").each(function(){
var _107=$(this).parent().attr("field");
var ed=$.data(this,"datagrid.editor");
ed.actions.setValue(ed.target,row[_107]);
});
_108(_104,_105);
};
function _109(_10a,_10b,_10c){
var opts=$.data(_10a,"datagrid").options;
var _10d=$.data(_10a,"datagrid").updatedRows;
var _10e=$.data(_10a,"datagrid").insertedRows;
var tr=opts.finder.getTr(_10a,_10b);
var row=opts.finder.getRow(_10a,_10b);
if(!tr.hasClass("datagrid-row-editing")){
return;
}
if(!_10c){
if(!_108(_10a,_10b)){
return;
}
var _10f=false;
var _110={};
tr.find("div.datagrid-editable").each(function(){
var _111=$(this).parent().attr("field");
var ed=$.data(this,"datagrid.editor");
var _112=ed.actions.getValue(ed.target);
if(row[_111]!=_112){
row[_111]=_112;
_10f=true;
_110[_111]=_112;
}
});
if(_10f){
if(_2(_10e,row)==-1){
if(_2(_10d,row)==-1){
_10d.push(row);
}
}
}
}
tr.removeClass("datagrid-row-editing");
_113(_10a,_10b);
$(_10a).datagrid("refreshRow",_10b);
if(!_10c){
opts.onAfterEdit.call(_10a,_10b,row,_110);
}else{
opts.onCancelEdit.call(_10a,_10b,row);
}
};
function _114(_115,_116){
var opts=$.data(_115,"datagrid").options;
var tr=opts.finder.getTr(_115,_116);
var _117=[];
tr.children("td").each(function(){
var cell=$(this).find("div.datagrid-editable");
if(cell.length){
var ed=$.data(cell[0],"datagrid.editor");
_117.push(ed);
}
});
return _117;
};
function _118(_119,_11a){
var _11b=_114(_119,_11a.index);
for(var i=0;i<_11b.length;i++){
if(_11b[i].field==_11a.field){
return _11b[i];
}
}
return null;
};
function _106(_11c,_11d){
var opts=$.data(_11c,"datagrid").options;
var tr=opts.finder.getTr(_11c,_11d);
tr.children("td").each(function(){
var cell=$(this).find("div.datagrid-cell");
var _11e=$(this).attr("field");
var col=_5c(_11c,_11e);
if(col&&col.editor){
var _11f,_120;
if(typeof col.editor=="string"){
_11f=col.editor;
}else{
_11f=col.editor.type;
_120=col.editor.options;
}
var _121=opts.editors[_11f];
if(_121){
var _122=cell.html();
var _123=cell._outerWidth();
cell.addClass("datagrid-editable");
cell._outerWidth(_123);
cell.html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td></td></tr></table>");
cell.children("table").bind("click dblclick contextmenu",function(e){
e.stopPropagation();
});
$.data(cell[0],"datagrid.editor",{actions:_121,target:_121.init(cell.find("td"),_120),field:_11e,type:_11f,oldHtml:_122});
}
}
});
_1e(_11c,_11d,true);
};
function _113(_124,_125){
var opts=$.data(_124,"datagrid").options;
var tr=opts.finder.getTr(_124,_125);
tr.children("td").each(function(){
var cell=$(this).find("div.datagrid-editable");
if(cell.length){
var ed=$.data(cell[0],"datagrid.editor");
if(ed.actions.destroy){
ed.actions.destroy(ed.target);
}
cell.html(ed.oldHtml);
$.removeData(cell[0],"datagrid.editor");
cell.removeClass("datagrid-editable");
cell.css("width","");
}
});
};
function _108(_126,_127){
var tr=$.data(_126,"datagrid").options.finder.getTr(_126,_127);
if(!tr.hasClass("datagrid-row-editing")){
return true;
}
var vbox=tr.find(".validatebox-text");
vbox.validatebox("validate");
vbox.trigger("mouseleave");
var _128=tr.find(".validatebox-invalid");
return _128.length==0;
};
function _129(_12a,_12b){
var _12c=$.data(_12a,"datagrid").insertedRows;
var _12d=$.data(_12a,"datagrid").deletedRows;
var _12e=$.data(_12a,"datagrid").updatedRows;
if(!_12b){
var rows=[];
rows=rows.concat(_12c);
rows=rows.concat(_12d);
rows=rows.concat(_12e);
return rows;
}else{
if(_12b=="inserted"){
return _12c;
}else{
if(_12b=="deleted"){
return _12d;
}else{
if(_12b=="updated"){
return _12e;
}
}
}
}
return [];
};
function _12f(_130,_131){
var _132=$.data(_130,"datagrid");
var opts=_132.options;
var data=_132.data;
var _133=_132.insertedRows;
var _134=_132.deletedRows;
$(_130).datagrid("cancelEdit",_131);
var row=data.rows[_131];
if(_2(_133,row)>=0){
_4(_133,row);
}else{
_134.push(row);
}
_4(_132.selectedRows,opts.idField,data.rows[_131][opts.idField]);
_4(_132.checkedRows,opts.idField,data.rows[_131][opts.idField]);
opts.view.deleteRow.call(opts.view,_130,_131);
if(opts.height=="auto"){
_1e(_130);
}
$(_130).datagrid("getPager").pagination("refresh",{total:data.total});
};
function _135(_136,_137){
var data=$.data(_136,"datagrid").data;
var view=$.data(_136,"datagrid").options.view;
var _138=$.data(_136,"datagrid").insertedRows;
view.insertRow.call(view,_136,_137.index,_137.row);
_138.push(_137.row);
$(_136).datagrid("getPager").pagination("refresh",{total:data.total});
};
function _139(_13a,row){
var data=$.data(_13a,"datagrid").data;
var view=$.data(_13a,"datagrid").options.view;
var _13b=$.data(_13a,"datagrid").insertedRows;
view.insertRow.call(view,_13a,null,row);
_13b.push(row);
$(_13a).datagrid("getPager").pagination("refresh",{total:data.total});
};
function _13c(_13d){
var _13e=$.data(_13d,"datagrid");
var data=_13e.data;
var rows=data.rows;
var _13f=[];
for(var i=0;i<rows.length;i++){
_13f.push($.extend({},rows[i]));
}
_13e.originalRows=_13f;
_13e.updatedRows=[];
_13e.insertedRows=[];
_13e.deletedRows=[];
};
function _140(_141){
var data=$.data(_141,"datagrid").data;
var ok=true;
for(var i=0,len=data.rows.length;i<len;i++){
if(_108(_141,i)){
_109(_141,i,false);
}else{
ok=false;
}
}
if(ok){
_13c(_141);
}
};
function _142(_143){
var _144=$.data(_143,"datagrid");
var opts=_144.options;
var _145=_144.originalRows;
var _146=_144.insertedRows;
var _147=_144.deletedRows;
var _148=_144.selectedRows;
var _149=_144.checkedRows;
var data=_144.data;
function _14a(a){
var ids=[];
for(var i=0;i<a.length;i++){
ids.push(a[i][opts.idField]);
}
return ids;
};
function _14b(ids,_14c){
for(var i=0;i<ids.length;i++){
var _14d=_b4(_143,ids[i]);
(_14c=="s"?_ca:_d2)(_143,_14d,true);
}
};
for(var i=0;i<data.rows.length;i++){
_109(_143,i,true);
}
var _14e=_14a(_148);
var _14f=_14a(_149);
_148.splice(0,_148.length);
_149.splice(0,_149.length);
data.total+=_147.length-_146.length;
data.rows=_145;
_ab(_143,data);
_14b(_14e,"s");
_14b(_14f,"c");
_13c(_143);
};
function _150(_151,_152){
var opts=$.data(_151,"datagrid").options;
if(_152){
opts.queryParams=_152;
}
var _153=$.extend({},opts.queryParams);
if(opts.pagination){
$.extend(_153,{page:opts.pageNumber,rows:opts.pageSize});
}
if(opts.sortName){
$.extend(_153,{sort:opts.sortName,order:opts.sortOrder});
}
if(opts.onBeforeLoad.call(_151,_153)==false){
return;
}
$(_151).datagrid("loading");
setTimeout(function(){
_154();
},0);
function _154(){
var _155=opts.loader.call(_151,_153,function(data){
setTimeout(function(){
$(_151).datagrid("loaded");
},0);
_ab(_151,data);
setTimeout(function(){
_13c(_151);
},0);
},function(){
setTimeout(function(){
$(_151).datagrid("loaded");
},0);
opts.onLoadError.apply(_151,arguments);
});
if(_155==false){
$(_151).datagrid("loaded");
}
};
};
function _156(_157,_158){
var opts=$.data(_157,"datagrid").options;
_158.rowspan=_158.rowspan||1;
_158.colspan=_158.colspan||1;
if(_158.rowspan==1&&_158.colspan==1){
return;
}
var tr=opts.finder.getTr(_157,(_158.index!=undefined?_158.index:_158.id));
if(!tr.length){
return;
}
var row=opts.finder.getRow(_157,tr);
var _159=row[_158.field];
var td=tr.find("td[field=\""+_158.field+"\"]");
td.attr("rowspan",_158.rowspan).attr("colspan",_158.colspan);
td.addClass("datagrid-td-merged");
for(var i=1;i<_158.colspan;i++){
td=td.next();
td.hide();
row[td.attr("field")]=_159;
}
for(var i=1;i<_158.rowspan;i++){
tr=tr.next();
if(!tr.length){
break;
}
var row=opts.finder.getRow(_157,tr);
var td=tr.find("td[field=\""+_158.field+"\"]").hide();
row[td.attr("field")]=_159;
for(var j=1;j<_158.colspan;j++){
td=td.next();
td.hide();
row[td.attr("field")]=_159;
}
}
_91(_157);
};
$.fn.datagrid=function(_15a,_15b){
if(typeof _15a=="string"){
return $.fn.datagrid.methods[_15a](this,_15b);
}
_15a=_15a||{};
return this.each(function(){
var _15c=$.data(this,"datagrid");
var opts;
if(_15c){
opts=$.extend(_15c.options,_15a);
_15c.options=opts;
}else{
opts=$.extend({},$.extend({},$.fn.datagrid.defaults,{queryParams:{}}),$.fn.datagrid.parseOptions(this),_15a);
$(this).css("width","").css("height","");
var _15d=_34(this,opts.rownumbers);
if(!opts.columns){
opts.columns=_15d.columns;
}
if(!opts.frozenColumns){
opts.frozenColumns=_15d.frozenColumns;
}
opts.columns=$.extend(true,[],opts.columns);
opts.frozenColumns=$.extend(true,[],opts.frozenColumns);
opts.view=$.extend({},opts.view);
$.data(this,"datagrid",{options:opts,panel:_15d.panel,dc:_15d.dc,selectedRows:[],checkedRows:[],data:{total:0,rows:[]},originalRows:[],updatedRows:[],insertedRows:[],deletedRows:[]});
}
_47(this);
if(opts.data){
_ab(this,opts.data);
_13c(this);
}else{
var data=_42(this);
if(data.total>0){
_ab(this,data);
_13c(this);
}
}
_9(this);
_150(this);
_5d(this);
});
};
var _15e={text:{init:function(_15f,_160){
var _161=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_15f);
return _161;
},getValue:function(_162){
return $(_162).val();
},setValue:function(_163,_164){
$(_163).val(_164);
},resize:function(_165,_166){
$(_165)._outerWidth(_166);
}},textarea:{init:function(_167,_168){
var _169=$("<textarea class=\"datagrid-editable-input\"></textarea>").appendTo(_167);
return _169;
},getValue:function(_16a){
return $(_16a).val();
},setValue:function(_16b,_16c){
$(_16b).val(_16c);
},resize:function(_16d,_16e){
$(_16d)._outerWidth(_16e);
}},checkbox:{init:function(_16f,_170){
var _171=$("<input type=\"checkbox\">").appendTo(_16f);
_171.val(_170.on);
_171.attr("offval",_170.off);
return _171;
},getValue:function(_172){
if($(_172).is(":checked")){
return $(_172).val();
}else{
return $(_172).attr("offval");
}
},setValue:function(_173,_174){
var _175=false;
if($(_173).val()==_174){
_175=true;
}
$(_173)._propAttr("checked",_175);
}},numberbox:{init:function(_176,_177){
var _178=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_176);
_178.numberbox(_177);
return _178;
},destroy:function(_179){
$(_179).numberbox("destroy");
},getValue:function(_17a){
$(_17a).blur();
return $(_17a).numberbox("getValue");
},setValue:function(_17b,_17c){
$(_17b).numberbox("setValue",_17c);
},resize:function(_17d,_17e){
$(_17d)._outerWidth(_17e);
}},validatebox:{init:function(_17f,_180){
var _181=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_17f);
_181.validatebox(_180);
return _181;
},destroy:function(_182){
$(_182).validatebox("destroy");
},getValue:function(_183){
return $(_183).val();
},setValue:function(_184,_185){
$(_184).val(_185);
},resize:function(_186,_187){
$(_186)._outerWidth(_187);
}},datebox:{init:function(_188,_189){
var _18a=$("<input type=\"text\">").appendTo(_188);
_18a.datebox(_189);
return _18a;
},destroy:function(_18b){
$(_18b).datebox("destroy");
},getValue:function(_18c){
return $(_18c).datebox("getValue");
},setValue:function(_18d,_18e){
$(_18d).datebox("setValue",_18e);
},resize:function(_18f,_190){
$(_18f).datebox("resize",_190);
}},combobox:{init:function(_191,_192){
var _193=$("<input type=\"text\">").appendTo(_191);
_193.combobox(_192||{});
return _193;
},destroy:function(_194){
$(_194).combobox("destroy");
},getValue:function(_195){
return $(_195).combobox("getValue");
},setValue:function(_196,_197){
$(_196).combobox("setValue",_197);
},resize:function(_198,_199){
$(_198).combobox("resize",_199);
}},combotree:{init:function(_19a,_19b){
var _19c=$("<input type=\"text\">").appendTo(_19a);
_19c.combotree(_19b);
return _19c;
},destroy:function(_19d){
$(_19d).combotree("destroy");
},getValue:function(_19e){
return $(_19e).combotree("getValue");
},setValue:function(_19f,_1a0){
$(_19f).combotree("setValue",_1a0);
},resize:function(_1a1,_1a2){
$(_1a1).combotree("resize",_1a2);
}}};
$.fn.datagrid.methods={options:function(jq){
var _1a3=$.data(jq[0],"datagrid").options;
var _1a4=$.data(jq[0],"datagrid").panel.panel("options");
var opts=$.extend(_1a3,{width:_1a4.width,height:_1a4.height,closed:_1a4.closed,collapsed:_1a4.collapsed,minimized:_1a4.minimized,maximized:_1a4.maximized});
return opts;
},getPanel:function(jq){
return $.data(jq[0],"datagrid").panel;
},getPager:function(jq){
return $.data(jq[0],"datagrid").panel.children("div.datagrid-pager");
},getColumnFields:function(jq,_1a5){
return _46(jq[0],_1a5);
},getColumnOption:function(jq,_1a6){
return _5c(jq[0],_1a6);
},resize:function(jq,_1a7){
return jq.each(function(){
_9(this,_1a7);
});
},load:function(jq,_1a8){
return jq.each(function(){
var opts=$(this).datagrid("options");
opts.pageNumber=1;
var _1a9=$(this).datagrid("getPager");
_1a9.pagination({pageNumber:1});
_150(this,_1a8);
});
},reload:function(jq,_1aa){
return jq.each(function(){
_150(this,_1aa);
});
},reloadFooter:function(jq,_1ab){
return jq.each(function(){
var opts=$.data(this,"datagrid").options;
var dc=$.data(this,"datagrid").dc;
if(_1ab){
$.data(this,"datagrid").footer=_1ab;
}
if(opts.showFooter){
opts.view.renderFooter.call(opts.view,this,dc.footer2,false);
opts.view.renderFooter.call(opts.view,this,dc.footer1,true);
if(opts.view.onAfterRender){
opts.view.onAfterRender.call(opts.view,this);
}
$(this).datagrid("fixRowHeight");
}
});
},loading:function(jq){
return jq.each(function(){
var opts=$.data(this,"datagrid").options;
$(this).datagrid("getPager").pagination("loading");
if(opts.loadMsg){
var _1ac=$(this).datagrid("getPanel");
$("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo(_1ac);
var msg=$("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(opts.loadMsg).appendTo(_1ac);
msg.css("marginLeft",-msg.outerWidth()/2);
}
});
},loaded:function(jq){
return jq.each(function(){
$(this).datagrid("getPager").pagination("loaded");
var _1ad=$(this).datagrid("getPanel");
_1ad.children("div.datagrid-mask-msg").remove();
_1ad.children("div.datagrid-mask").remove();
});
},fitColumns:function(jq){
return jq.each(function(){
_73(this);
});
},fixColumnSize:function(jq,_1ae){
return jq.each(function(){
_3e(this,_1ae);
});
},fixRowHeight:function(jq,_1af){
return jq.each(function(){
_1e(this,_1af);
});
},freezeRow:function(jq,_1b0){
return jq.each(function(){
_2c(this,_1b0);
});
},autoSizeColumn:function(jq,_1b1){
return jq.each(function(){
_81(this,_1b1);
});
},loadData:function(jq,data){
return jq.each(function(){
_ab(this,data);
_13c(this);
});
},getData:function(jq){
return $.data(jq[0],"datagrid").data;
},getRows:function(jq){
return $.data(jq[0],"datagrid").data.rows;
},getFooterRows:function(jq){
return $.data(jq[0],"datagrid").footer;
},getRowIndex:function(jq,id){
return _b4(jq[0],id);
},getChecked:function(jq){
return _bf(jq[0]);
},getSelected:function(jq){
var rows=_b8(jq[0]);
return rows.length>0?rows[0]:null;
},getSelections:function(jq){
return _b8(jq[0]);
},clearSelections:function(jq){
return jq.each(function(){
var _1b2=$.data(this,"datagrid").selectedRows;
_1b2.splice(0,_1b2.length);
_d1(this);
});
},clearChecked:function(jq){
return jq.each(function(){
var _1b3=$.data(this,"datagrid").checkedRows;
_1b3.splice(0,_1b3.length);
_ed(this);
});
},selectAll:function(jq){
return jq.each(function(){
_de(this);
});
},unselectAll:function(jq){
return jq.each(function(){
_d1(this);
});
},selectRow:function(jq,_1b4){
return jq.each(function(){
_ca(this,_1b4);
});
},selectRecord:function(jq,id){
return jq.each(function(){
_c5(this,id);
});
},unselectRow:function(jq,_1b5){
return jq.each(function(){
_d6(this,_1b5);
});
},checkRow:function(jq,_1b6){
return jq.each(function(){
_d2(this,_1b6);
});
},uncheckRow:function(jq,_1b7){
return jq.each(function(){
_dd(this,_1b7);
});
},checkAll:function(jq){
return jq.each(function(){
_e5(this);
});
},uncheckAll:function(jq){
return jq.each(function(){
_ed(this);
});
},beginEdit:function(jq,_1b8){
return jq.each(function(){
_103(this,_1b8);
});
},endEdit:function(jq,_1b9){
return jq.each(function(){
_109(this,_1b9,false);
});
},cancelEdit:function(jq,_1ba){
return jq.each(function(){
_109(this,_1ba,true);
});
},getEditors:function(jq,_1bb){
return _114(jq[0],_1bb);
},getEditor:function(jq,_1bc){
return _118(jq[0],_1bc);
},refreshRow:function(jq,_1bd){
return jq.each(function(){
var opts=$.data(this,"datagrid").options;
opts.view.refreshRow.call(opts.view,this,_1bd);
});
},validateRow:function(jq,_1be){
return _108(jq[0],_1be);
},updateRow:function(jq,_1bf){
return jq.each(function(){
var opts=$.data(this,"datagrid").options;
opts.view.updateRow.call(opts.view,this,_1bf.index,_1bf.row);
});
},appendRow:function(jq,row){
return jq.each(function(){
_139(this,row);
});
},insertRow:function(jq,_1c0){
return jq.each(function(){
_135(this,_1c0);
});
},deleteRow:function(jq,_1c1){
return jq.each(function(){
_12f(this,_1c1);
});
},getChanges:function(jq,_1c2){
return _129(jq[0],_1c2);
},acceptChanges:function(jq){
return jq.each(function(){
_140(this);
});
},rejectChanges:function(jq){
return jq.each(function(){
_142(this);
});
},mergeCells:function(jq,_1c3){
return jq.each(function(){
_156(this,_1c3);
});
},showColumn:function(jq,_1c4){
return jq.each(function(){
var _1c5=$(this).datagrid("getPanel");
_1c5.find("td[field=\""+_1c4+"\"]").show();
$(this).datagrid("getColumnOption",_1c4).hidden=false;
$(this).datagrid("fitColumns");
});
},hideColumn:function(jq,_1c6){
return jq.each(function(){
var _1c7=$(this).datagrid("getPanel");
_1c7.find("td[field=\""+_1c6+"\"]").hide();
$(this).datagrid("getColumnOption",_1c6).hidden=true;
$(this).datagrid("fitColumns");
});
}};
$.fn.datagrid.parseOptions=function(_1c8){
var t=$(_1c8);
return $.extend({},$.fn.panel.parseOptions(_1c8),$.parser.parseOptions(_1c8,["url","toolbar","idField","sortName","sortOrder","pagePosition","resizeHandle",{fitColumns:"boolean",autoRowHeight:"boolean",striped:"boolean",nowrap:"boolean"},{rownumbers:"boolean",singleSelect:"boolean",checkOnSelect:"boolean",selectOnCheck:"boolean"},{pagination:"boolean",pageSize:"number",pageNumber:"number"},{remoteSort:"boolean",showHeader:"boolean",showFooter:"boolean"},{scrollbarSize:"number"}]),{pageList:(t.attr("pageList")?eval(t.attr("pageList")):undefined),loadMsg:(t.attr("loadMsg")!=undefined?t.attr("loadMsg"):undefined),rowStyler:(t.attr("rowStyler")?eval(t.attr("rowStyler")):undefined)});
};
var _1c9={render:function(_1ca,_1cb,_1cc){
var _1cd=$.data(_1ca,"datagrid");
var opts=_1cd.options;
var rows=_1cd.data.rows;
var _1ce=$(_1ca).datagrid("getColumnFields",_1cc);
if(_1cc){
if(!(opts.rownumbers||(opts.frozenColumns&&opts.frozenColumns.length))){
return;
}
}
var _1cf=["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
for(var i=0;i<rows.length;i++){
var cls=(i%2&&opts.striped)?"class=\"datagrid-row datagrid-row-alt\"":"class=\"datagrid-row\"";
var _1d0=opts.rowStyler?opts.rowStyler.call(_1ca,i,rows[i]):"";
var _1d1=_1d0?"style=\""+_1d0+"\"":"";
var _1d2=_1cd.rowIdPrefix+"-"+(_1cc?1:2)+"-"+i;
_1cf.push("<tr id=\""+_1d2+"\" datagrid-row-index=\""+i+"\" "+cls+" "+_1d1+">");
_1cf.push(this.renderRow.call(this,_1ca,_1ce,_1cc,i,rows[i]));
_1cf.push("</tr>");
}
_1cf.push("</tbody></table>");
$(_1cb).html(_1cf.join(""));
},renderFooter:function(_1d3,_1d4,_1d5){
var opts=$.data(_1d3,"datagrid").options;
var rows=$.data(_1d3,"datagrid").footer||[];
var _1d6=$(_1d3).datagrid("getColumnFields",_1d5);
var _1d7=["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
for(var i=0;i<rows.length;i++){
_1d7.push("<tr class=\"datagrid-row\" datagrid-row-index=\""+i+"\">");
_1d7.push(this.renderRow.call(this,_1d3,_1d6,_1d5,i,rows[i]));
_1d7.push("</tr>");
}
_1d7.push("</tbody></table>");
$(_1d4).html(_1d7.join(""));
},renderRow:function(_1d8,_1d9,_1da,_1db,_1dc){
var opts=$.data(_1d8,"datagrid").options;
var cc=[];
if(_1da&&opts.rownumbers){
var _1dd=_1db+1;
if(opts.pagination){
_1dd+=(opts.pageNumber-1)*opts.pageSize;
}
cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">"+_1dd+"</div></td>");
}
for(var i=0;i<_1d9.length;i++){
var _1de=_1d9[i];
var col=$(_1d8).datagrid("getColumnOption",_1de);
if(col){
var _1df=_1dc[_1de];
var _1e0=col.styler?(col.styler(_1df,_1dc,_1db)||""):"";
var _1e1=col.hidden?"style=\"display:none;"+_1e0+"\"":(_1e0?"style=\""+_1e0+"\"":"");
cc.push("<td field=\""+_1de+"\" "+_1e1+">");
if(col.checkbox){
var _1e1="";
}else{
var _1e1="";
if(col.align){
_1e1+="text-align:"+col.align+";";
}
if(!opts.nowrap){
_1e1+="white-space:normal;height:auto;";
}else{
if(opts.autoRowHeight){
_1e1+="height:auto;";
}
}
}
cc.push("<div style=\""+_1e1+"\" ");
if(col.checkbox){
cc.push("class=\"datagrid-cell-check ");
}else{
cc.push("class=\"datagrid-cell "+col.cellClass);
}
cc.push("\">");
if(col.checkbox){
cc.push("<input type=\"checkbox\" name=\""+_1de+"\" value=\""+(_1df!=undefined?_1df:"")+"\"/>");
}else{
if(col.formatter){
cc.push(col.formatter(_1df,_1dc,_1db));
}else{
cc.push(_1df);
}
}
cc.push("</div>");
cc.push("</td>");
}
}
return cc.join("");
},refreshRow:function(_1e2,_1e3){
this.updateRow.call(this,_1e2,_1e3,{});
},updateRow:function(_1e4,_1e5,row){
var opts=$.data(_1e4,"datagrid").options;
var rows=$(_1e4).datagrid("getRows");
$.extend(rows[_1e5],row);
var _1e6=opts.rowStyler?opts.rowStyler.call(_1e4,_1e5,rows[_1e5]):"";
function _1e7(_1e8){
var _1e9=$(_1e4).datagrid("getColumnFields",_1e8);
var tr=opts.finder.getTr(_1e4,_1e5,"body",(_1e8?1:2));
var _1ea=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
tr.html(this.renderRow.call(this,_1e4,_1e9,_1e8,_1e5,rows[_1e5]));
tr.attr("style",_1e6||"");
if(_1ea){
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true);
}
};
_1e7.call(this,true);
_1e7.call(this,false);
$(_1e4).datagrid("fixRowHeight",_1e5);
},insertRow:function(_1eb,_1ec,row){
var _1ed=$.data(_1eb,"datagrid");
var opts=_1ed.options;
var dc=_1ed.dc;
var data=_1ed.data;
if(_1ec==undefined||_1ec==null){
_1ec=data.rows.length;
}
if(_1ec>data.rows.length){
_1ec=data.rows.length;
}
function _1ee(_1ef){
var _1f0=_1ef?1:2;
for(var i=data.rows.length-1;i>=_1ec;i--){
var tr=opts.finder.getTr(_1eb,i,"body",_1f0);
tr.attr("datagrid-row-index",i+1);
tr.attr("id",_1ed.rowIdPrefix+"-"+_1f0+"-"+(i+1));
if(_1ef&&opts.rownumbers){
var _1f1=i+2;
if(opts.pagination){
_1f1+=(opts.pageNumber-1)*opts.pageSize;
}
tr.find("div.datagrid-cell-rownumber").html(_1f1);
}
}
};
function _1f2(_1f3){
var _1f4=_1f3?1:2;
var _1f5=$(_1eb).datagrid("getColumnFields",_1f3);
var _1f6=_1ed.rowIdPrefix+"-"+_1f4+"-"+_1ec;
var tr="<tr id=\""+_1f6+"\" class=\"datagrid-row\" datagrid-row-index=\""+_1ec+"\"></tr>";
if(_1ec>=data.rows.length){
if(data.rows.length){
opts.finder.getTr(_1eb,"","last",_1f4).after(tr);
}else{
var cc=_1f3?dc.body1:dc.body2;
cc.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"+tr+"</tbody></table>");
}
}else{
opts.finder.getTr(_1eb,_1ec+1,"body",_1f4).before(tr);
}
};
_1ee.call(this,true);
_1ee.call(this,false);
_1f2.call(this,true);
_1f2.call(this,false);
data.total+=1;
data.rows.splice(_1ec,0,row);
this.refreshRow.call(this,_1eb,_1ec);
},deleteRow:function(_1f7,_1f8){
var _1f9=$.data(_1f7,"datagrid");
var opts=_1f9.options;
var data=_1f9.data;
function _1fa(_1fb){
var _1fc=_1fb?1:2;
for(var i=_1f8+1;i<data.rows.length;i++){
var tr=opts.finder.getTr(_1f7,i,"body",_1fc);
tr.attr("datagrid-row-index",i-1);
tr.attr("id",_1f9.rowIdPrefix+"-"+_1fc+"-"+(i-1));
if(_1fb&&opts.rownumbers){
var _1fd=i;
if(opts.pagination){
_1fd+=(opts.pageNumber-1)*opts.pageSize;
}
tr.find("div.datagrid-cell-rownumber").html(_1fd);
}
}
};
opts.finder.getTr(_1f7,_1f8).remove();
_1fa.call(this,true);
_1fa.call(this,false);
data.total-=1;
data.rows.splice(_1f8,1);
},onBeforeRender:function(_1fe,rows){
},onAfterRender:function(_1ff){
var opts=$.data(_1ff,"datagrid").options;
if(opts.showFooter){
var _200=$(_1ff).datagrid("getPanel").find("div.datagrid-footer");
_200.find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility","hidden");
}
}};
$.fn.datagrid.defaults=$.extend({},$.fn.panel.defaults,{frozenColumns:undefined,columns:undefined,fitColumns:false,resizeHandle:"right",autoRowHeight:true,toolbar:null,striped:false,method:"post",nowrap:true,idField:null,url:null,data:null,loadMsg:"Processing, please wait ...",rownumbers:false,singleSelect:false,selectOnCheck:true,checkOnSelect:true,pagination:false,pagePosition:"bottom",pageNumber:1,pageSize:10,pageList:[10,20,30,40,50],queryParams:{},sortName:null,sortOrder:"asc",remoteSort:true,showHeader:true,showFooter:false,scrollbarSize:18,rowStyler:function(_201,_202){
},loader:function(_203,_204,_205){
var opts=$(this).datagrid("options");
if(!opts.url){
return false;
}
$.ajax({type:opts.method,url:opts.url,data:_203,dataType:"json",success:function(data){
_204(data);
},error:function(){
_205.apply(this,arguments);
}});
},loadFilter:function(data){
if(typeof data.length=="number"&&typeof data.splice=="function"){
return {total:data.length,rows:data};
}else{
return data;
}
},editors:_15e,finder:{getTr:function(_206,_207,type,_208){
type=type||"body";
_208=_208||0;
var _209=$.data(_206,"datagrid");
var dc=_209.dc;
var opts=_209.options;
if(_208==0){
var tr1=opts.finder.getTr(_206,_207,type,1);
var tr2=opts.finder.getTr(_206,_207,type,2);
return tr1.add(tr2);
}else{
if(type=="body"){
var tr=$("#"+_209.rowIdPrefix+"-"+_208+"-"+_207);
if(!tr.length){
tr=(_208==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index="+_207+"]");
}
return tr;
}else{
if(type=="footer"){
return (_208==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index="+_207+"]");
}else{
if(type=="selected"){
return (_208==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-selected");
}else{
if(type=="last"){
return (_208==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]:last");
}else{
if(type=="allbody"){
return (_208==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]");
}else{
if(type=="allfooter"){
return (_208==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index]");
}
}
}
}
}
}
}
},getRow:function(_20a,p){
var _20b=(typeof p=="object")?p.attr("datagrid-row-index"):p;
return $.data(_20a,"datagrid").data.rows[parseInt(_20b)];
}},view:_1c9,onBeforeLoad:function(_20c){
},onLoadSuccess:function(){
},onLoadError:function(){
},onClickRow:function(_20d,_20e){
},onDblClickRow:function(_20f,_210){
},onClickCell:function(_211,_212,_213){
},onDblClickCell:function(_214,_215,_216){
},onSortColumn:function(sort,_217){
},onResizeColumn:function(_218,_219){
},onSelect:function(_21a,_21b){
},onUnselect:function(_21c,_21d){
},onSelectAll:function(rows){
},onUnselectAll:function(rows){
},onCheck:function(_21e,_21f){
},onUncheck:function(_220,_221){
},onCheckAll:function(rows){
},onUncheckAll:function(rows){
},onBeforeEdit:function(_222,_223){
},onAfterEdit:function(_224,_225,_226){
},onCancelEdit:function(_227,_228){
},onHeaderContextMenu:function(e,_229){
},onRowContextMenu:function(e,_22a,_22b){
}});
})(jQuery);

