You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2506 lines
64 KiB
Plaintext
2506 lines
64 KiB
Plaintext
/**
|
|
* jQuery EasyUI 1.4.5
|
|
*
|
|
* Copyright (c) 2009-2016 www.jeasyui.com. All rights reserved.
|
|
*
|
|
* Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php
|
|
* To use it on other terms please contact us: info@jeasyui.com
|
|
*
|
|
*/
|
|
(function($){
|
|
var _1=0;
|
|
function _2(a,o){
|
|
return $.easyui.indexOfArray(a,o);
|
|
};
|
|
function _3(a,o,id){
|
|
$.easyui.removeArrayItem(a,o,id);
|
|
};
|
|
function _4(a,o,r){
|
|
$.easyui.addArrayItem(a,o,r);
|
|
};
|
|
function _5(_6,aa){
|
|
return $.data(_6,"treegrid")?aa.slice(1):aa;
|
|
};
|
|
function _7(_8){
|
|
var _9=$.data(_8,"datagrid");
|
|
var _a=_9.options;
|
|
var _b=_9.panel;
|
|
var dc=_9.dc;
|
|
var ss=null;
|
|
if(_a.sharedStyleSheet){
|
|
ss=typeof _a.sharedStyleSheet=="boolean"?"head":_a.sharedStyleSheet;
|
|
}else{
|
|
ss=_b.closest("div.datagrid-view");
|
|
if(!ss.length){
|
|
ss=dc.view;
|
|
}
|
|
}
|
|
var cc=$(ss);
|
|
var _c=$.data(cc[0],"ss");
|
|
if(!_c){
|
|
_c=$.data(cc[0],"ss",{cache:{},dirty:[]});
|
|
}
|
|
return {add:function(_d){
|
|
var ss=["<style type=\"text/css\" easyui=\"true\">"];
|
|
for(var i=0;i<_d.length;i++){
|
|
_c.cache[_d[i][0]]={width:_d[i][1]};
|
|
}
|
|
var _e=0;
|
|
for(var s in _c.cache){
|
|
var _f=_c.cache[s];
|
|
_f.index=_e++;
|
|
ss.push(s+"{width:"+_f.width+"}");
|
|
}
|
|
ss.push("</style>");
|
|
$(ss.join("\n")).appendTo(cc);
|
|
cc.children("style[easyui]:not(:last)").remove();
|
|
},getRule:function(_10){
|
|
var _11=cc.children("style[easyui]:last")[0];
|
|
var _12=_11.styleSheet?_11.styleSheet:(_11.sheet||document.styleSheets[document.styleSheets.length-1]);
|
|
var _13=_12.cssRules||_12.rules;
|
|
return _13[_10];
|
|
},set:function(_14,_15){
|
|
var _16=_c.cache[_14];
|
|
if(_16){
|
|
_16.width=_15;
|
|
var _17=this.getRule(_16.index);
|
|
if(_17){
|
|
_17.style["width"]=_15;
|
|
}
|
|
}
|
|
},remove:function(_18){
|
|
var tmp=[];
|
|
for(var s in _c.cache){
|
|
if(s.indexOf(_18)==-1){
|
|
tmp.push([s,_c.cache[s].width]);
|
|
}
|
|
}
|
|
_c.cache={};
|
|
this.add(tmp);
|
|
},dirty:function(_19){
|
|
if(_19){
|
|
_c.dirty.push(_19);
|
|
}
|
|
},clean:function(){
|
|
for(var i=0;i<_c.dirty.length;i++){
|
|
this.remove(_c.dirty[i]);
|
|
}
|
|
_c.dirty=[];
|
|
}};
|
|
};
|
|
function _1a(_1b,_1c){
|
|
var _1d=$.data(_1b,"datagrid");
|
|
var _1e=_1d.options;
|
|
var _1f=_1d.panel;
|
|
if(_1c){
|
|
$.extend(_1e,_1c);
|
|
}
|
|
if(_1e.fit==true){
|
|
var p=_1f.panel("panel").parent();
|
|
_1e.width=p.width();
|
|
_1e.height=p.height();
|
|
}
|
|
_1f.panel("resize",_1e);
|
|
};
|
|
function _20(_21){
|
|
var _22=$.data(_21,"datagrid");
|
|
var _23=_22.options;
|
|
var dc=_22.dc;
|
|
var _24=_22.panel;
|
|
var _25=_24.width();
|
|
var _26=_24.height();
|
|
var _27=dc.view;
|
|
var _28=dc.view1;
|
|
var _29=dc.view2;
|
|
var _2a=_28.children("div.datagrid-header");
|
|
var _2b=_29.children("div.datagrid-header");
|
|
var _2c=_2a.find("table");
|
|
var _2d=_2b.find("table");
|
|
_27.width(_25);
|
|
var _2e=_2a.children("div.datagrid-header-inner").show();
|
|
_28.width(_2e.find("table").width());
|
|
if(!_23.showHeader){
|
|
_2e.hide();
|
|
}
|
|
_29.width(_25-_28._outerWidth());
|
|
_28.children()._outerWidth(_28.width());
|
|
_29.children()._outerWidth(_29.width());
|
|
var all=_2a.add(_2b).add(_2c).add(_2d);
|
|
all.css("height","");
|
|
var hh=Math.max(_2c.height(),_2d.height());
|
|
all._outerHeight(hh);
|
|
dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({position:"absolute",top:dc.header2._outerHeight()});
|
|
var _2f=dc.body2.children("table.datagrid-btable-frozen")._outerHeight();
|
|
var _30=_2f+_2b._outerHeight()+_29.children(".datagrid-footer")._outerHeight();
|
|
_24.children(":not(.datagrid-view,.datagrid-mask,.datagrid-mask-msg)").each(function(){
|
|
_30+=$(this)._outerHeight();
|
|
});
|
|
var _31=_24.outerHeight()-_24.height();
|
|
var _32=_24._size("minHeight")||"";
|
|
var _33=_24._size("maxHeight")||"";
|
|
_28.add(_29).children("div.datagrid-body").css({marginTop:_2f,height:(isNaN(parseInt(_23.height))?"":(_26-_30)),minHeight:(_32?_32-_31-_30:""),maxHeight:(_33?_33-_31-_30:"")});
|
|
_27.height(_29.height());
|
|
};
|
|
function _34(_35,_36,_37){
|
|
var _38=$.data(_35,"datagrid").data.rows;
|
|
var _39=$.data(_35,"datagrid").options;
|
|
var dc=$.data(_35,"datagrid").dc;
|
|
if(!dc.body1.is(":empty")&&(!_39.nowrap||_39.autoRowHeight||_37)){
|
|
if(_36!=undefined){
|
|
var tr1=_39.finder.getTr(_35,_36,"body",1);
|
|
var tr2=_39.finder.getTr(_35,_36,"body",2);
|
|
_3a(tr1,tr2);
|
|
}else{
|
|
var tr1=_39.finder.getTr(_35,0,"allbody",1);
|
|
var tr2=_39.finder.getTr(_35,0,"allbody",2);
|
|
_3a(tr1,tr2);
|
|
if(_39.showFooter){
|
|
var tr1=_39.finder.getTr(_35,0,"allfooter",1);
|
|
var tr2=_39.finder.getTr(_35,0,"allfooter",2);
|
|
_3a(tr1,tr2);
|
|
}
|
|
}
|
|
}
|
|
_20(_35);
|
|
if(_39.height=="auto"){
|
|
var _3b=dc.body1.parent();
|
|
var _3c=dc.body2;
|
|
var _3d=_3e(_3c);
|
|
var _3f=_3d.height;
|
|
if(_3d.width>_3c.width()){
|
|
_3f+=18;
|
|
}
|
|
_3f-=parseInt(_3c.css("marginTop"))||0;
|
|
_3b.height(_3f);
|
|
_3c.height(_3f);
|
|
dc.view.height(dc.view2.height());
|
|
}
|
|
dc.body2.triggerHandler("scroll");
|
|
function _3a(_40,_41){
|
|
for(var i=0;i<_41.length;i++){
|
|
var tr1=$(_40[i]);
|
|
var tr2=$(_41[i]);
|
|
tr1.css("height","");
|
|
tr2.css("height","");
|
|
var _42=Math.max(tr1.height(),tr2.height());
|
|
tr1.css("height",_42);
|
|
tr2.css("height",_42);
|
|
}
|
|
};
|
|
function _3e(cc){
|
|
var _43=0;
|
|
var _44=0;
|
|
$(cc).children().each(function(){
|
|
var c=$(this);
|
|
if(c.is(":visible")){
|
|
_44+=c._outerHeight();
|
|
if(_43<c._outerWidth()){
|
|
_43=c._outerWidth();
|
|
}
|
|
}
|
|
});
|
|
return {width:_43,height:_44};
|
|
};
|
|
};
|
|
function _45(_46,_47){
|
|
var _48=$.data(_46,"datagrid");
|
|
var _49=_48.options;
|
|
var dc=_48.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>");
|
|
}
|
|
_4a(true);
|
|
_4a(false);
|
|
_20(_46);
|
|
function _4a(_4b){
|
|
var _4c=_4b?1:2;
|
|
var tr=_49.finder.getTr(_46,_47,"body",_4c);
|
|
(_4b?dc.body1:dc.body2).children("table.datagrid-btable-frozen").append(tr);
|
|
};
|
|
};
|
|
function _4d(_4e,_4f){
|
|
function _50(){
|
|
var _51=[];
|
|
var _52=[];
|
|
$(_4e).children("thead").each(function(){
|
|
var opt=$.parser.parseOptions(this,[{frozen:"boolean"}]);
|
|
$(this).find("tr").each(function(){
|
|
var _53=[];
|
|
$(this).find("th").each(function(){
|
|
var th=$(this);
|
|
var col=$.extend({},$.parser.parseOptions(this,["id","field","align","halign","order","width",{sortable:"boolean",checkbox:"boolean",resizable:"boolean",fixed:"boolean"},{rowspan:"number",colspan:"number"}]),{title:(th.html()||undefined),hidden:(th.attr("hidden")?true:undefined),formatter:(th.attr("formatter")?cceval(th.attr("formatter")):undefined),styler:(th.attr("styler")?cceval(th.attr("styler")):undefined),sorter:(th.attr("sorter")?cceval(th.attr("sorter")):undefined)});
|
|
if(col.width&&String(col.width).indexOf("%")==-1){
|
|
col.width=parseInt(col.width);
|
|
}
|
|
if(th.attr("editor")){
|
|
var s=$.trim(th.attr("editor"));
|
|
if(s.substr(0,1)=="{"){
|
|
col.editor=cceval("("+s+")");
|
|
}else{
|
|
col.editor=s;
|
|
}
|
|
}
|
|
_53.push(col);
|
|
});
|
|
opt.frozen?_51.push(_53):_52.push(_53);
|
|
});
|
|
});
|
|
return [_51,_52];
|
|
};
|
|
var _54=$("<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(_4e);
|
|
_54.panel({doSize:false,cls:"datagrid"});
|
|
$(_4e).addClass("datagrid-f").hide().appendTo(_54.children("div.datagrid-view"));
|
|
var cc=_50();
|
|
var _55=_54.children("div.datagrid-view");
|
|
var _56=_55.children("div.datagrid-view1");
|
|
var _57=_55.children("div.datagrid-view2");
|
|
return {panel:_54,frozenColumns:cc[0],columns:cc[1],dc:{view:_55,view1:_56,view2:_57,header1:_56.children("div.datagrid-header").children("div.datagrid-header-inner"),header2:_57.children("div.datagrid-header").children("div.datagrid-header-inner"),body1:_56.children("div.datagrid-body").children("div.datagrid-body-inner"),body2:_57.children("div.datagrid-body"),footer1:_56.children("div.datagrid-footer").children("div.datagrid-footer-inner"),footer2:_57.children("div.datagrid-footer").children("div.datagrid-footer-inner")}};
|
|
};
|
|
function _58(_59){
|
|
var _5a=$.data(_59,"datagrid");
|
|
var _5b=_5a.options;
|
|
var dc=_5a.dc;
|
|
var _5c=_5a.panel;
|
|
_5a.ss=$(_59).datagrid("createStyleSheet");
|
|
_5c.panel($.extend({},_5b,{id:null,doSize:false,onResize:function(_5d,_5e){
|
|
if($.data(_59,"datagrid")){
|
|
_20(_59);
|
|
$(_59).datagrid("fitColumns");
|
|
_5b.onResize.call(_5c,_5d,_5e);
|
|
}
|
|
},onExpand:function(){
|
|
if($.data(_59,"datagrid")){
|
|
$(_59).datagrid("fixRowHeight").datagrid("fitColumns");
|
|
_5b.onExpand.call(_5c);
|
|
}
|
|
}}));
|
|
_5a.rowIdPrefix="datagrid-row-r"+(++_1);
|
|
_5a.cellClassPrefix="datagrid-cell-c"+_1;
|
|
_5f(dc.header1,_5b.frozenColumns,true);
|
|
_5f(dc.header2,_5b.columns,false);
|
|
_60();
|
|
dc.header1.add(dc.header2).css("display",_5b.showHeader?"block":"none");
|
|
dc.footer1.add(dc.footer2).css("display",_5b.showFooter?"block":"none");
|
|
if(_5b.toolbar){
|
|
if($.isArray(_5b.toolbar)){
|
|
$("div.datagrid-toolbar",_5c).remove();
|
|
var tb=$("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_5c);
|
|
var tr=tb.find("tr");
|
|
for(var i=0;i<_5b.toolbar.length;i++){
|
|
var btn=_5b.toolbar[i];
|
|
if(btn=="-"){
|
|
$("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr);
|
|
}else{
|
|
var td=$("<td></td>").appendTo(tr);
|
|
var _61=$("<a href=\"javascript:void(0)\"></a>").appendTo(td);
|
|
_61[0].onclick=cceval(btn.handler||function(){
|
|
});
|
|
_61.linkbutton($.extend({},btn,{plain:true}));
|
|
}
|
|
}
|
|
}else{
|
|
$(_5b.toolbar).addClass("datagrid-toolbar").prependTo(_5c);
|
|
$(_5b.toolbar).show();
|
|
}
|
|
}else{
|
|
$("div.datagrid-toolbar",_5c).remove();
|
|
}
|
|
$("div.datagrid-pager",_5c).remove();
|
|
if(_5b.pagination){
|
|
var _62=$("<div class=\"datagrid-pager\"></div>");
|
|
if(_5b.pagePosition=="bottom"){
|
|
_62.appendTo(_5c);
|
|
}else{
|
|
if(_5b.pagePosition=="top"){
|
|
_62.addClass("datagrid-pager-top").prependTo(_5c);
|
|
}else{
|
|
var _63=$("<div class=\"datagrid-pager datagrid-pager-top\"></div>").prependTo(_5c);
|
|
_62.appendTo(_5c);
|
|
_62=_62.add(_63);
|
|
}
|
|
}
|
|
_62.pagination({total:(_5b.pageNumber*_5b.pageSize),pageNumber:_5b.pageNumber,pageSize:_5b.pageSize,pageList:_5b.pageList,onSelectPage:function(_64,_65){
|
|
_5b.pageNumber=_64||1;
|
|
_5b.pageSize=_65;
|
|
_62.pagination("refresh",{pageNumber:_64,pageSize:_65});
|
|
_af(_59);
|
|
}});
|
|
_5b.pageSize=_62.pagination("options").pageSize;
|
|
}
|
|
function _5f(_66,_67,_68){
|
|
if(!_67){
|
|
return;
|
|
}
|
|
$(_66).show();
|
|
$(_66).empty();
|
|
var _69=[];
|
|
var _6a=[];
|
|
var _6b=[];
|
|
if(_5b.sortName){
|
|
_69=_5b.sortName.split(",");
|
|
_6a=_5b.sortOrder.split(",");
|
|
}
|
|
var t=$("<table class=\"datagrid-htable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>").appendTo(_66);
|
|
for(var i=0;i<_67.length;i++){
|
|
var tr=$("<tr class=\"datagrid-header-row\"></tr>").appendTo($("tbody",t));
|
|
var _6c=_67[i];
|
|
for(var j=0;j<_6c.length;j++){
|
|
var col=_6c[j];
|
|
var _6d="";
|
|
if(col.rowspan){
|
|
_6d+="rowspan=\""+col.rowspan+"\" ";
|
|
}
|
|
if(col.colspan){
|
|
_6d+="colspan=\""+col.colspan+"\" ";
|
|
if(!col.id){
|
|
col.id=["datagrid-td-group"+_1,i,j].join("-");
|
|
}
|
|
}
|
|
if(col.id){
|
|
_6d+="id=\""+col.id+"\"";
|
|
}
|
|
var td=$("<td "+_6d+"></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>");
|
|
td.find("span:first").html(col.title);
|
|
var _6e=td.find("div.datagrid-cell");
|
|
var pos=_2(_69,col.field);
|
|
if(pos>=0){
|
|
_6e.addClass("datagrid-sort-"+_6a[pos]);
|
|
}
|
|
if(col.sortable){
|
|
_6e.addClass("datagrid-sort");
|
|
}
|
|
if(col.resizable==false){
|
|
_6e.attr("resizable","false");
|
|
}
|
|
if(col.width){
|
|
var _6f=$.parser.parseValue("width",col.width,dc.view,_5b.scrollbarSize);
|
|
_6e._outerWidth(_6f-1);
|
|
col.boxWidth=parseInt(_6e[0].style.width);
|
|
col.deltaWidth=_6f-col.boxWidth;
|
|
}else{
|
|
col.auto=true;
|
|
}
|
|
_6e.css("text-align",(col.halign||col.align||""));
|
|
col.cellClass=_5a.cellClassPrefix+"-"+col.field.replace(/[\.|\s]/g,"-");
|
|
_6e.addClass(col.cellClass).css("width","");
|
|
}else{
|
|
$("<div class=\"datagrid-cell-group\"></div>").html(col.title).appendTo(td);
|
|
}
|
|
}
|
|
if(col.hidden){
|
|
td.hide();
|
|
_6b.push(col.field);
|
|
}
|
|
}
|
|
}
|
|
if(_68&&_5b.rownumbers){
|
|
var td=$("<td rowspan=\""+_5b.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));
|
|
}
|
|
}
|
|
for(var i=0;i<_6b.length;i++){
|
|
_b1(_59,_6b[i],-1);
|
|
}
|
|
};
|
|
function _60(){
|
|
var _70=[];
|
|
var _71=_72(_59,true).concat(_72(_59));
|
|
for(var i=0;i<_71.length;i++){
|
|
var col=_73(_59,_71[i]);
|
|
if(col&&!col.checkbox){
|
|
_70.push(["."+col.cellClass,col.boxWidth?col.boxWidth+"px":"auto"]);
|
|
}
|
|
}
|
|
_5a.ss.add(_70);
|
|
_5a.ss.dirty(_5a.cellSelectorPrefix);
|
|
_5a.cellSelectorPrefix="."+_5a.cellClassPrefix;
|
|
};
|
|
};
|
|
function _74(_75){
|
|
var _76=$.data(_75,"datagrid");
|
|
var _77=_76.panel;
|
|
var _78=_76.options;
|
|
var dc=_76.dc;
|
|
var _79=dc.header1.add(dc.header2);
|
|
_79.find("input[type=checkbox]").unbind(".datagrid").bind("click.datagrid",function(e){
|
|
if(_78.singleSelect&&_78.selectOnCheck){
|
|
return false;
|
|
}
|
|
if($(this).is(":checked")){
|
|
_130(_75);
|
|
}else{
|
|
_136(_75);
|
|
}
|
|
e.stopPropagation();
|
|
});
|
|
var _7a=_79.find("div.datagrid-cell");
|
|
_7a.closest("td").unbind(".datagrid").bind("mouseenter.datagrid",function(){
|
|
if(_76.resizing){
|
|
return;
|
|
}
|
|
$(this).addClass("datagrid-header-over");
|
|
}).bind("mouseleave.datagrid",function(){
|
|
$(this).removeClass("datagrid-header-over");
|
|
}).bind("contextmenu.datagrid",function(e){
|
|
var _7b=$(this).attr("field");
|
|
_78.onHeaderContextMenu.call(_75,e,_7b);
|
|
});
|
|
_7a.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){
|
|
_a3(_75,$(this).parent().attr("field"));
|
|
}
|
|
}).bind("dblclick.datagrid",function(e){
|
|
var p1=$(this).offset().left+5;
|
|
var p2=$(this).offset().left+$(this)._outerWidth()-5;
|
|
var _7c=_78.resizeHandle=="right"?(e.pageX>p2):(_78.resizeHandle=="left"?(e.pageX<p1):(e.pageX<p1||e.pageX>p2));
|
|
if(_7c){
|
|
var _7d=$(this).parent().attr("field");
|
|
var col=_73(_75,_7d);
|
|
if(col.resizable==false){
|
|
return;
|
|
}
|
|
$(_75).datagrid("autoSizeColumn",_7d);
|
|
col.auto=false;
|
|
}
|
|
});
|
|
var _7e=_78.resizeHandle=="right"?"e":(_78.resizeHandle=="left"?"w":"e,w");
|
|
_7a.each(function(){
|
|
$(this).resizable({handles:_7e,disabled:($(this).attr("resizable")?$(this).attr("resizable")=="false":false),minWidth:25,onStartResize:function(e){
|
|
_76.resizing=true;
|
|
_79.css("cursor",$("body").css("cursor"));
|
|
if(!_76.proxy){
|
|
_76.proxy=$("<div class=\"datagrid-resize-proxy\"></div>").appendTo(dc.view);
|
|
}
|
|
_76.proxy.css({left:e.pageX-$(_77).offset().left-1,display:"none"});
|
|
setTimeout(function(){
|
|
if(_76.proxy){
|
|
_76.proxy.show();
|
|
}
|
|
},500);
|
|
},onResize:function(e){
|
|
_76.proxy.css({left:e.pageX-$(_77).offset().left-1,display:"block"});
|
|
return false;
|
|
},onStopResize:function(e){
|
|
_79.css("cursor","");
|
|
$(this).css("height","");
|
|
var _7f=$(this).parent().attr("field");
|
|
var col=_73(_75,_7f);
|
|
col.width=$(this)._outerWidth();
|
|
col.boxWidth=col.width-col.deltaWidth;
|
|
col.auto=undefined;
|
|
$(this).css("width","");
|
|
$(_75).datagrid("fixColumnSize",_7f);
|
|
_76.proxy.remove();
|
|
_76.proxy=null;
|
|
if($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")){
|
|
_20(_75);
|
|
}
|
|
$(_75).datagrid("fitColumns");
|
|
_78.onResizeColumn.call(_75,_7f,col.width);
|
|
setTimeout(function(){
|
|
_76.resizing=false;
|
|
},0);
|
|
}});
|
|
});
|
|
var bb=dc.body1.add(dc.body2);
|
|
bb.unbind();
|
|
for(var _80 in _78.rowEvents){
|
|
bb.bind(_80,_78.rowEvents[_80]);
|
|
}
|
|
dc.body1.bind("mousewheel DOMMouseScroll",function(e){
|
|
e.preventDefault();
|
|
var e1=e.originalEvent||window.event;
|
|
var _81=e1.wheelDelta||e1.detail*(-1);
|
|
if("deltaY" in e1){
|
|
_81=e1.deltaY*-1;
|
|
}
|
|
var dg=$(e.target).closest("div.datagrid-view").children(".datagrid-f");
|
|
var dc=dg.data("datagrid").dc;
|
|
dc.body2.scrollTop(dc.body2.scrollTop()-_81);
|
|
});
|
|
dc.body2.bind("scroll",function(){
|
|
var b1=dc.view1.children("div.datagrid-body");
|
|
b1.scrollTop($(this).scrollTop());
|
|
var c1=dc.body1.children(":first");
|
|
var c2=dc.body2.children(":first");
|
|
if(c1.length&&c2.length){
|
|
var _82=c1.offset().top;
|
|
var _83=c2.offset().top;
|
|
if(_82!=_83){
|
|
b1.scrollTop(b1.scrollTop()+_82-_83);
|
|
}
|
|
}
|
|
dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft());
|
|
dc.body2.children("table.datagrid-btable-frozen").css("left",-$(this)._scrollLeft());
|
|
});
|
|
};
|
|
function _84(_85){
|
|
return function(e){
|
|
var tr=_86(e.target);
|
|
if(!tr){
|
|
return;
|
|
}
|
|
var _87=_88(tr);
|
|
if($.data(_87,"datagrid").resizing){
|
|
return;
|
|
}
|
|
var _89=_8a(tr);
|
|
if(_85){
|
|
_8b(_87,_89);
|
|
}else{
|
|
var _8c=$.data(_87,"datagrid").options;
|
|
_8c.finder.getTr(_87,_89).removeClass("datagrid-row-over");
|
|
}
|
|
};
|
|
};
|
|
function _8d(e){
|
|
var tr=_86(e.target);
|
|
if(!tr){
|
|
return;
|
|
}
|
|
var _8e=_88(tr);
|
|
var _8f=$.data(_8e,"datagrid").options;
|
|
var _90=_8a(tr);
|
|
var tt=$(e.target);
|
|
if(tt.parent().hasClass("datagrid-cell-check")){
|
|
if(_8f.singleSelect&&_8f.selectOnCheck){
|
|
tt._propAttr("checked",!tt.is(":checked"));
|
|
_91(_8e,_90);
|
|
}else{
|
|
if(tt.is(":checked")){
|
|
tt._propAttr("checked",false);
|
|
_91(_8e,_90);
|
|
}else{
|
|
tt._propAttr("checked",true);
|
|
_92(_8e,_90);
|
|
}
|
|
}
|
|
}else{
|
|
var row=_8f.finder.getRow(_8e,_90);
|
|
var td=tt.closest("td[field]",tr);
|
|
if(td.length){
|
|
var _93=td.attr("field");
|
|
_8f.onClickCell.call(_8e,_90,_93,row[_93]);
|
|
}
|
|
if(_8f.singleSelect==true){
|
|
_94(_8e,_90);
|
|
}else{
|
|
if(_8f.ctrlSelect){
|
|
if(e.ctrlKey){
|
|
if(tr.hasClass("datagrid-row-selected")){
|
|
_95(_8e,_90);
|
|
}else{
|
|
_94(_8e,_90);
|
|
}
|
|
}else{
|
|
if(e.shiftKey){
|
|
$(_8e).datagrid("clearSelections");
|
|
var _96=Math.min(_8f.lastSelectedIndex||0,_90);
|
|
var _97=Math.max(_8f.lastSelectedIndex||0,_90);
|
|
for(var i=_96;i<=_97;i++){
|
|
_94(_8e,i);
|
|
}
|
|
}else{
|
|
$(_8e).datagrid("clearSelections");
|
|
_94(_8e,_90);
|
|
_8f.lastSelectedIndex=_90;
|
|
}
|
|
}
|
|
}else{
|
|
if(tr.hasClass("datagrid-row-selected")){
|
|
_95(_8e,_90);
|
|
}else{
|
|
_94(_8e,_90);
|
|
}
|
|
}
|
|
}
|
|
_8f.onClickRow.apply(_8e,_5(_8e,[_90,row]));
|
|
}
|
|
};
|
|
function _98(e){
|
|
var tr=_86(e.target);
|
|
if(!tr){
|
|
return;
|
|
}
|
|
var _99=_88(tr);
|
|
var _9a=$.data(_99,"datagrid").options;
|
|
var _9b=_8a(tr);
|
|
var row=_9a.finder.getRow(_99,_9b);
|
|
var td=$(e.target).closest("td[field]",tr);
|
|
if(td.length){
|
|
var _9c=td.attr("field");
|
|
_9a.onDblClickCell.call(_99,_9b,_9c,row[_9c]);
|
|
}
|
|
_9a.onDblClickRow.apply(_99,_5(_99,[_9b,row]));
|
|
};
|
|
function _9d(e){
|
|
var tr=_86(e.target);
|
|
if(tr){
|
|
var _9e=_88(tr);
|
|
var _9f=$.data(_9e,"datagrid").options;
|
|
var _a0=_8a(tr);
|
|
var row=_9f.finder.getRow(_9e,_a0);
|
|
_9f.onRowContextMenu.call(_9e,e,_a0,row);
|
|
}else{
|
|
var _a1=_86(e.target,".datagrid-body");
|
|
if(_a1){
|
|
var _9e=_88(_a1);
|
|
var _9f=$.data(_9e,"datagrid").options;
|
|
_9f.onRowContextMenu.call(_9e,e,-1,null);
|
|
}
|
|
}
|
|
};
|
|
function _88(t){
|
|
return $(t).closest("div.datagrid-view").children(".datagrid-f")[0];
|
|
};
|
|
function _86(t,_a2){
|
|
var tr=$(t).closest(_a2||"tr.datagrid-row");
|
|
if(tr.length&&tr.parent().length){
|
|
return tr;
|
|
}else{
|
|
return undefined;
|
|
}
|
|
};
|
|
function _8a(tr){
|
|
if(tr.attr("datagrid-row-index")){
|
|
return parseInt(tr.attr("datagrid-row-index"));
|
|
}else{
|
|
return tr.attr("node-id");
|
|
}
|
|
};
|
|
function _a3(_a4,_a5){
|
|
var _a6=$.data(_a4,"datagrid");
|
|
var _a7=_a6.options;
|
|
_a5=_a5||{};
|
|
var _a8={sortName:_a7.sortName,sortOrder:_a7.sortOrder};
|
|
if(typeof _a5=="object"){
|
|
$.extend(_a8,_a5);
|
|
}
|
|
var _a9=[];
|
|
var _aa=[];
|
|
if(_a8.sortName){
|
|
_a9=_a8.sortName.split(",");
|
|
_aa=_a8.sortOrder.split(",");
|
|
}
|
|
if(typeof _a5=="string"){
|
|
var _ab=_a5;
|
|
var col=_73(_a4,_ab);
|
|
if(!col.sortable||_a6.resizing){
|
|
return;
|
|
}
|
|
var _ac=col.order||"asc";
|
|
var pos=_2(_a9,_ab);
|
|
if(pos>=0){
|
|
var _ad=_aa[pos]=="asc"?"desc":"asc";
|
|
if(_a7.multiSort&&_ad==_ac){
|
|
_a9.splice(pos,1);
|
|
_aa.splice(pos,1);
|
|
}else{
|
|
_aa[pos]=_ad;
|
|
}
|
|
}else{
|
|
if(_a7.multiSort){
|
|
_a9.push(_ab);
|
|
_aa.push(_ac);
|
|
}else{
|
|
_a9=[_ab];
|
|
_aa=[_ac];
|
|
}
|
|
}
|
|
_a8.sortName=_a9.join(",");
|
|
_a8.sortOrder=_aa.join(",");
|
|
}
|
|
if(_a7.onBeforeSortColumn.call(_a4,_a8.sortName,_a8.sortOrder)==false){
|
|
return;
|
|
}
|
|
$.extend(_a7,_a8);
|
|
var dc=_a6.dc;
|
|
var _ae=dc.header1.add(dc.header2);
|
|
_ae.find("div.datagrid-cell").removeClass("datagrid-sort-asc datagrid-sort-desc");
|
|
for(var i=0;i<_a9.length;i++){
|
|
var col=_73(_a4,_a9[i]);
|
|
_ae.find("div."+col.cellClass).addClass("datagrid-sort-"+_aa[i]);
|
|
}
|
|
if(_a7.remoteSort){
|
|
_af(_a4);
|
|
}else{
|
|
_b0(_a4,$(_a4).datagrid("getData"));
|
|
}
|
|
_a7.onSortColumn.call(_a4,_a7.sortName,_a7.sortOrder);
|
|
};
|
|
function _b1(_b2,_b3,_b4){
|
|
_b5(true);
|
|
_b5(false);
|
|
function _b5(_b6){
|
|
var aa=_b7(_b2,_b6);
|
|
if(aa.length){
|
|
var _b8=aa[aa.length-1];
|
|
var _b9=_2(_b8,_b3);
|
|
if(_b9>=0){
|
|
for(var _ba=0;_ba<aa.length-1;_ba++){
|
|
var td=$("#"+aa[_ba][_b9]);
|
|
var _bb=parseInt(td.attr("colspan")||1)+(_b4||0);
|
|
td.attr("colspan",_bb);
|
|
if(_bb){
|
|
td.show();
|
|
}else{
|
|
td.hide();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function _bc(_bd){
|
|
var _be=$.data(_bd,"datagrid");
|
|
var _bf=_be.options;
|
|
var dc=_be.dc;
|
|
var _c0=dc.view2.children("div.datagrid-header");
|
|
dc.body2.css("overflow-x","");
|
|
_c1();
|
|
_c2();
|
|
_c3();
|
|
_c1(true);
|
|
if(_c0.width()>=_c0.find("table").width()){
|
|
dc.body2.css("overflow-x","hidden");
|
|
}
|
|
function _c3(){
|
|
if(!_bf.fitColumns){
|
|
return;
|
|
}
|
|
if(!_be.leftWidth){
|
|
_be.leftWidth=0;
|
|
}
|
|
var _c4=0;
|
|
var cc=[];
|
|
var _c5=_72(_bd,false);
|
|
for(var i=0;i<_c5.length;i++){
|
|
var col=_73(_bd,_c5[i]);
|
|
if(_c6(col)){
|
|
_c4+=col.width;
|
|
cc.push({field:col.field,col:col,addingWidth:0});
|
|
}
|
|
}
|
|
if(!_c4){
|
|
return;
|
|
}
|
|
cc[cc.length-1].addingWidth-=_be.leftWidth;
|
|
var _c7=_c0.children("div.datagrid-header-inner").show();
|
|
var _c8=_c0.width()-_c0.find("table").width()-_bf.scrollbarSize+_be.leftWidth;
|
|
var _c9=_c8/_c4;
|
|
if(!_bf.showHeader){
|
|
_c7.hide();
|
|
}
|
|
for(var i=0;i<cc.length;i++){
|
|
var c=cc[i];
|
|
var _ca=parseInt(c.col.width*_c9);
|
|
c.addingWidth+=_ca;
|
|
_c8-=_ca;
|
|
}
|
|
cc[cc.length-1].addingWidth+=_c8;
|
|
for(var i=0;i<cc.length;i++){
|
|
var c=cc[i];
|
|
if(c.col.boxWidth+c.addingWidth>0){
|
|
c.col.boxWidth+=c.addingWidth;
|
|
c.col.width+=c.addingWidth;
|
|
}
|
|
}
|
|
_be.leftWidth=_c8;
|
|
$(_bd).datagrid("fixColumnSize");
|
|
};
|
|
function _c2(){
|
|
var _cb=false;
|
|
var _cc=_72(_bd,true).concat(_72(_bd,false));
|
|
$.map(_cc,function(_cd){
|
|
var col=_73(_bd,_cd);
|
|
if(String(col.width||"").indexOf("%")>=0){
|
|
var _ce=$.parser.parseValue("width",col.width,dc.view,_bf.scrollbarSize)-col.deltaWidth;
|
|
if(_ce>0){
|
|
col.boxWidth=_ce;
|
|
_cb=true;
|
|
}
|
|
}
|
|
});
|
|
if(_cb){
|
|
$(_bd).datagrid("fixColumnSize");
|
|
}
|
|
};
|
|
function _c1(fit){
|
|
var _cf=dc.header1.add(dc.header2).find(".datagrid-cell-group");
|
|
if(_cf.length){
|
|
_cf.each(function(){
|
|
$(this)._outerWidth(fit?$(this).parent().width():10);
|
|
});
|
|
if(fit){
|
|
_20(_bd);
|
|
}
|
|
}
|
|
};
|
|
function _c6(col){
|
|
if(String(col.width||"").indexOf("%")>=0){
|
|
return false;
|
|
}
|
|
if(!col.hidden&&!col.checkbox&&!col.auto&&!col.fixed){
|
|
return true;
|
|
}
|
|
};
|
|
};
|
|
function _d0(_d1,_d2){
|
|
var _d3=$.data(_d1,"datagrid");
|
|
var _d4=_d3.options;
|
|
var dc=_d3.dc;
|
|
var tmp=$("<div class=\"datagrid-cell\" style=\"position:absolute;left:-9999px\"></div>").appendTo("body");
|
|
if(_d2){
|
|
_1a(_d2);
|
|
$(_d1).datagrid("fitColumns");
|
|
}else{
|
|
var _d5=false;
|
|
var _d6=_72(_d1,true).concat(_72(_d1,false));
|
|
for(var i=0;i<_d6.length;i++){
|
|
var _d2=_d6[i];
|
|
var col=_73(_d1,_d2);
|
|
if(col.auto){
|
|
_1a(_d2);
|
|
_d5=true;
|
|
}
|
|
}
|
|
if(_d5){
|
|
$(_d1).datagrid("fitColumns");
|
|
}
|
|
}
|
|
tmp.remove();
|
|
function _1a(_d7){
|
|
var _d8=dc.view.find("div.datagrid-header td[field=\""+_d7+"\"] div.datagrid-cell");
|
|
_d8.css("width","");
|
|
var col=$(_d1).datagrid("getColumnOption",_d7);
|
|
col.width=undefined;
|
|
col.boxWidth=undefined;
|
|
col.auto=true;
|
|
$(_d1).datagrid("fixColumnSize",_d7);
|
|
var _d9=Math.max(_da("header"),_da("allbody"),_da("allfooter"))+1;
|
|
_d8._outerWidth(_d9-1);
|
|
col.width=_d9;
|
|
col.boxWidth=parseInt(_d8[0].style.width);
|
|
col.deltaWidth=_d9-col.boxWidth;
|
|
_d8.css("width","");
|
|
$(_d1).datagrid("fixColumnSize",_d7);
|
|
_d4.onResizeColumn.call(_d1,_d7,col.width);
|
|
function _da(_db){
|
|
var _dc=0;
|
|
if(_db=="header"){
|
|
_dc=_dd(_d8);
|
|
}else{
|
|
_d4.finder.getTr(_d1,0,_db).find("td[field=\""+_d7+"\"] div.datagrid-cell").each(function(){
|
|
var w=_dd($(this));
|
|
if(_dc<w){
|
|
_dc=w;
|
|
}
|
|
});
|
|
}
|
|
return _dc;
|
|
function _dd(_de){
|
|
return _de.is(":visible")?_de._outerWidth():tmp.html(_de.html())._outerWidth();
|
|
};
|
|
};
|
|
};
|
|
};
|
|
function _df(_e0,_e1){
|
|
var _e2=$.data(_e0,"datagrid");
|
|
var _e3=_e2.options;
|
|
var dc=_e2.dc;
|
|
var _e4=dc.view.find("table.datagrid-btable,table.datagrid-ftable");
|
|
_e4.css("table-layout","fixed");
|
|
if(_e1){
|
|
fix(_e1);
|
|
}else{
|
|
var ff=_72(_e0,true).concat(_72(_e0,false));
|
|
for(var i=0;i<ff.length;i++){
|
|
fix(ff[i]);
|
|
}
|
|
}
|
|
_e4.css("table-layout","");
|
|
_e5(_e0);
|
|
_34(_e0);
|
|
_e6(_e0);
|
|
function fix(_e7){
|
|
var col=_73(_e0,_e7);
|
|
if(col.cellClass){
|
|
_e2.ss.set("."+col.cellClass,col.boxWidth?col.boxWidth+"px":"auto");
|
|
}
|
|
};
|
|
};
|
|
function _e5(_e8){
|
|
var dc=$.data(_e8,"datagrid").dc;
|
|
dc.view.find("td.datagrid-td-merged").each(function(){
|
|
var td=$(this);
|
|
var _e9=td.attr("colspan")||1;
|
|
var col=_73(_e8,td.attr("field"));
|
|
var _ea=col.boxWidth+col.deltaWidth-1;
|
|
for(var i=1;i<_e9;i++){
|
|
td=td.next();
|
|
col=_73(_e8,td.attr("field"));
|
|
_ea+=col.boxWidth+col.deltaWidth;
|
|
}
|
|
$(this).children("div.datagrid-cell")._outerWidth(_ea);
|
|
});
|
|
};
|
|
function _e6(_eb){
|
|
var dc=$.data(_eb,"datagrid").dc;
|
|
dc.view.find("div.datagrid-editable").each(function(){
|
|
var _ec=$(this);
|
|
var _ed=_ec.parent().attr("field");
|
|
var col=$(_eb).datagrid("getColumnOption",_ed);
|
|
_ec._outerWidth(col.boxWidth+col.deltaWidth-1);
|
|
var ed=$.data(this,"datagrid.editor");
|
|
if(ed.actions.resize){
|
|
ed.actions.resize(ed.target,_ec.width());
|
|
}
|
|
});
|
|
};
|
|
function _73(_ee,_ef){
|
|
function _f0(_f1){
|
|
if(_f1){
|
|
for(var i=0;i<_f1.length;i++){
|
|
var cc=_f1[i];
|
|
for(var j=0;j<cc.length;j++){
|
|
var c=cc[j];
|
|
if(c.field==_ef){
|
|
return c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
var _f2=$.data(_ee,"datagrid").options;
|
|
var col=_f0(_f2.columns);
|
|
if(!col){
|
|
col=_f0(_f2.frozenColumns);
|
|
}
|
|
return col;
|
|
};
|
|
function _b7(_f3,_f4){
|
|
var _f5=$.data(_f3,"datagrid").options;
|
|
var _f6=_f4?_f5.frozenColumns:_f5.columns;
|
|
var aa=[];
|
|
var _f7=_f8();
|
|
for(var i=0;i<_f6.length;i++){
|
|
aa[i]=new Array(_f7);
|
|
}
|
|
for(var _f9=0;_f9<_f6.length;_f9++){
|
|
$.map(_f6[_f9],function(col){
|
|
var _fa=_fb(aa[_f9]);
|
|
if(_fa>=0){
|
|
var _fc=col.field||col.id||"";
|
|
for(var c=0;c<(col.colspan||1);c++){
|
|
for(var r=0;r<(col.rowspan||1);r++){
|
|
aa[_f9+r][_fa]=_fc;
|
|
}
|
|
_fa++;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return aa;
|
|
function _f8(){
|
|
var _fd=0;
|
|
$.map(_f6[0]||[],function(col){
|
|
_fd+=col.colspan||1;
|
|
});
|
|
return _fd;
|
|
};
|
|
function _fb(a){
|
|
for(var i=0;i<a.length;i++){
|
|
if(a[i]==undefined){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
};
|
|
};
|
|
function _72(_fe,_ff){
|
|
var aa=_b7(_fe,_ff);
|
|
return aa.length?aa[aa.length-1]:aa;
|
|
};
|
|
function _b0(_100,data){
|
|
var _101=$.data(_100,"datagrid");
|
|
var opts=_101.options;
|
|
var dc=_101.dc;
|
|
data=opts.loadFilter.call(_100,data);
|
|
if($.isArray(data)){
|
|
data={total:data.length,rows:data};
|
|
}
|
|
data.total=parseInt(data.total);
|
|
_101.data=data;
|
|
if(data.footer){
|
|
_101.footer=data.footer;
|
|
}
|
|
if(!opts.remoteSort&&opts.sortName){
|
|
var _102=opts.sortName.split(",");
|
|
var _103=opts.sortOrder.split(",");
|
|
data.rows.sort(function(r1,r2){
|
|
var r=0;
|
|
for(var i=0;i<_102.length;i++){
|
|
var sn=_102[i];
|
|
var so=_103[i];
|
|
var col=_73(_100,sn);
|
|
var _104=col.sorter||function(a,b){
|
|
return a==b?0:(a>b?1:-1);
|
|
};
|
|
r=_104(r1[sn],r2[sn])*(so=="asc"?1:-1);
|
|
if(r!=0){
|
|
return r;
|
|
}
|
|
}
|
|
return r;
|
|
});
|
|
}
|
|
if(opts.view.onBeforeRender){
|
|
opts.view.onBeforeRender.call(opts.view,_100,data.rows);
|
|
}
|
|
opts.view.render.call(opts.view,_100,dc.body2,false);
|
|
opts.view.render.call(opts.view,_100,dc.body1,true);
|
|
if(opts.showFooter){
|
|
opts.view.renderFooter.call(opts.view,_100,dc.footer2,false);
|
|
opts.view.renderFooter.call(opts.view,_100,dc.footer1,true);
|
|
}
|
|
if(opts.view.onAfterRender){
|
|
opts.view.onAfterRender.call(opts.view,_100);
|
|
}
|
|
_101.ss.clean();
|
|
var _105=$(_100).datagrid("getPager");
|
|
if(_105.length){
|
|
var _106=_105.pagination("options");
|
|
if(_106.total!=data.total){
|
|
_105.pagination("refresh",{total:data.total});
|
|
if(opts.pageNumber!=_106.pageNumber&&_106.pageNumber>0){
|
|
opts.pageNumber=_106.pageNumber;
|
|
_af(_100);
|
|
}
|
|
}
|
|
}
|
|
_34(_100);
|
|
dc.body2.triggerHandler("scroll");
|
|
$(_100).datagrid("setSelectionState");
|
|
$(_100).datagrid("autoSizeColumn");
|
|
opts.onLoadSuccess.call(_100,data);
|
|
};
|
|
function _107(_108){
|
|
var _109=$.data(_108,"datagrid");
|
|
var opts=_109.options;
|
|
var dc=_109.dc;
|
|
dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked",false);
|
|
if(opts.idField){
|
|
var _10a=$.data(_108,"treegrid")?true:false;
|
|
var _10b=opts.onSelect;
|
|
var _10c=opts.onCheck;
|
|
opts.onSelect=opts.onCheck=function(){
|
|
};
|
|
var rows=opts.finder.getRows(_108);
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
var _10d=_10a?row[opts.idField]:i;
|
|
if(_10e(_109.selectedRows,row)){
|
|
_94(_108,_10d,true);
|
|
}
|
|
if(_10e(_109.checkedRows,row)){
|
|
_91(_108,_10d,true);
|
|
}
|
|
}
|
|
opts.onSelect=_10b;
|
|
opts.onCheck=_10c;
|
|
}
|
|
function _10e(a,r){
|
|
for(var i=0;i<a.length;i++){
|
|
if(a[i][opts.idField]==r[opts.idField]){
|
|
a[i]=r;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
};
|
|
function _10f(_110,row){
|
|
var _111=$.data(_110,"datagrid");
|
|
var opts=_111.options;
|
|
var rows=_111.data.rows;
|
|
if(typeof row=="object"){
|
|
return _2(rows,row);
|
|
}else{
|
|
for(var i=0;i<rows.length;i++){
|
|
if(rows[i][opts.idField]==row){
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
};
|
|
function _112(_113){
|
|
var _114=$.data(_113,"datagrid");
|
|
var opts=_114.options;
|
|
var data=_114.data;
|
|
if(opts.idField){
|
|
return _114.selectedRows;
|
|
}else{
|
|
var rows=[];
|
|
opts.finder.getTr(_113,"","selected",2).each(function(){
|
|
rows.push(opts.finder.getRow(_113,$(this)));
|
|
});
|
|
return rows;
|
|
}
|
|
};
|
|
function _115(_116){
|
|
var _117=$.data(_116,"datagrid");
|
|
var opts=_117.options;
|
|
if(opts.idField){
|
|
return _117.checkedRows;
|
|
}else{
|
|
var rows=[];
|
|
opts.finder.getTr(_116,"","checked",2).each(function(){
|
|
rows.push(opts.finder.getRow(_116,$(this)));
|
|
});
|
|
return rows;
|
|
}
|
|
};
|
|
function _118(_119,_11a){
|
|
var _11b=$.data(_119,"datagrid");
|
|
var dc=_11b.dc;
|
|
var opts=_11b.options;
|
|
var tr=opts.finder.getTr(_119,_11a);
|
|
if(tr.length){
|
|
if(tr.closest("table").hasClass("datagrid-btable-frozen")){
|
|
return;
|
|
}
|
|
var _11c=dc.view2.children("div.datagrid-header")._outerHeight();
|
|
var _11d=dc.body2;
|
|
var _11e=_11d.outerHeight(true)-_11d.outerHeight();
|
|
var top=tr.position().top-_11c-_11e;
|
|
if(top<0){
|
|
_11d.scrollTop(_11d.scrollTop()+top);
|
|
}else{
|
|
if(top+tr._outerHeight()>_11d.height()-18){
|
|
_11d.scrollTop(_11d.scrollTop()+top+tr._outerHeight()-_11d.height()+18);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
function _8b(_11f,_120){
|
|
var _121=$.data(_11f,"datagrid");
|
|
var opts=_121.options;
|
|
opts.finder.getTr(_11f,_121.highlightIndex).removeClass("datagrid-row-over");
|
|
opts.finder.getTr(_11f,_120).addClass("datagrid-row-over");
|
|
_121.highlightIndex=_120;
|
|
};
|
|
function _94(_122,_123,_124){
|
|
var _125=$.data(_122,"datagrid");
|
|
var opts=_125.options;
|
|
var row=opts.finder.getRow(_122,_123);
|
|
if(opts.onBeforeSelect.apply(_122,_5(_122,[_123,row]))==false){
|
|
return;
|
|
}
|
|
if(opts.singleSelect){
|
|
_126(_122,true);
|
|
_125.selectedRows=[];
|
|
}
|
|
if(!_124&&opts.checkOnSelect){
|
|
_91(_122,_123,true);
|
|
}
|
|
if(opts.idField){
|
|
_4(_125.selectedRows,opts.idField,row);
|
|
}
|
|
opts.finder.getTr(_122,_123).addClass("datagrid-row-selected");
|
|
opts.onSelect.apply(_122,_5(_122,[_123,row]));
|
|
_118(_122,_123);
|
|
};
|
|
function _95(_127,_128,_129){
|
|
var _12a=$.data(_127,"datagrid");
|
|
var dc=_12a.dc;
|
|
var opts=_12a.options;
|
|
var row=opts.finder.getRow(_127,_128);
|
|
if(opts.onBeforeUnselect.apply(_127,_5(_127,[_128,row]))==false){
|
|
return;
|
|
}
|
|
if(!_129&&opts.checkOnSelect){
|
|
_92(_127,_128,true);
|
|
}
|
|
opts.finder.getTr(_127,_128).removeClass("datagrid-row-selected");
|
|
if(opts.idField){
|
|
_3(_12a.selectedRows,opts.idField,row[opts.idField]);
|
|
}
|
|
opts.onUnselect.apply(_127,_5(_127,[_128,row]));
|
|
};
|
|
function _12b(_12c,_12d){
|
|
var _12e=$.data(_12c,"datagrid");
|
|
var opts=_12e.options;
|
|
var rows=opts.finder.getRows(_12c);
|
|
var _12f=$.data(_12c,"datagrid").selectedRows;
|
|
if(!_12d&&opts.checkOnSelect){
|
|
_130(_12c,true);
|
|
}
|
|
opts.finder.getTr(_12c,"","allbody").addClass("datagrid-row-selected");
|
|
if(opts.idField){
|
|
for(var _131=0;_131<rows.length;_131++){
|
|
_4(_12f,opts.idField,rows[_131]);
|
|
}
|
|
}
|
|
opts.onSelectAll.call(_12c,rows);
|
|
};
|
|
function _126(_132,_133){
|
|
var _134=$.data(_132,"datagrid");
|
|
var opts=_134.options;
|
|
var rows=opts.finder.getRows(_132);
|
|
var _135=$.data(_132,"datagrid").selectedRows;
|
|
if(!_133&&opts.checkOnSelect){
|
|
_136(_132,true);
|
|
}
|
|
opts.finder.getTr(_132,"","selected").removeClass("datagrid-row-selected");
|
|
if(opts.idField){
|
|
for(var _137=0;_137<rows.length;_137++){
|
|
_3(_135,opts.idField,rows[_137][opts.idField]);
|
|
}
|
|
}
|
|
opts.onUnselectAll.call(_132,rows);
|
|
};
|
|
function _91(_138,_139,_13a){
|
|
var _13b=$.data(_138,"datagrid");
|
|
var opts=_13b.options;
|
|
var row=opts.finder.getRow(_138,_139);
|
|
if(opts.onBeforeCheck.apply(_138,_5(_138,[_139,row]))==false){
|
|
return;
|
|
}
|
|
if(opts.singleSelect&&opts.selectOnCheck){
|
|
_136(_138,true);
|
|
_13b.checkedRows=[];
|
|
}
|
|
if(!_13a&&opts.selectOnCheck){
|
|
_94(_138,_139,true);
|
|
}
|
|
var tr=opts.finder.getTr(_138,_139).addClass("datagrid-row-checked");
|
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true);
|
|
tr=opts.finder.getTr(_138,"","checked",2);
|
|
if(tr.length==opts.finder.getRows(_138).length){
|
|
var dc=_13b.dc;
|
|
dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked",true);
|
|
}
|
|
if(opts.idField){
|
|
_4(_13b.checkedRows,opts.idField,row);
|
|
}
|
|
opts.onCheck.apply(_138,_5(_138,[_139,row]));
|
|
};
|
|
function _92(_13c,_13d,_13e){
|
|
var _13f=$.data(_13c,"datagrid");
|
|
var opts=_13f.options;
|
|
var row=opts.finder.getRow(_13c,_13d);
|
|
if(opts.onBeforeUncheck.apply(_13c,_5(_13c,[_13d,row]))==false){
|
|
return;
|
|
}
|
|
if(!_13e&&opts.selectOnCheck){
|
|
_95(_13c,_13d,true);
|
|
}
|
|
var tr=opts.finder.getTr(_13c,_13d).removeClass("datagrid-row-checked");
|
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",false);
|
|
var dc=_13f.dc;
|
|
var _140=dc.header1.add(dc.header2);
|
|
_140.find("input[type=checkbox]")._propAttr("checked",false);
|
|
if(opts.idField){
|
|
_3(_13f.checkedRows,opts.idField,row[opts.idField]);
|
|
}
|
|
opts.onUncheck.apply(_13c,_5(_13c,[_13d,row]));
|
|
};
|
|
function _130(_141,_142){
|
|
var _143=$.data(_141,"datagrid");
|
|
var opts=_143.options;
|
|
var rows=opts.finder.getRows(_141);
|
|
if(!_142&&opts.selectOnCheck){
|
|
_12b(_141,true);
|
|
}
|
|
var dc=_143.dc;
|
|
var hck=dc.header1.add(dc.header2).find("input[type=checkbox]");
|
|
var bck=opts.finder.getTr(_141,"","allbody").addClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]");
|
|
hck.add(bck)._propAttr("checked",true);
|
|
if(opts.idField){
|
|
for(var i=0;i<rows.length;i++){
|
|
_4(_143.checkedRows,opts.idField,rows[i]);
|
|
}
|
|
}
|
|
opts.onCheckAll.call(_141,rows);
|
|
};
|
|
function _136(_144,_145){
|
|
var _146=$.data(_144,"datagrid");
|
|
var opts=_146.options;
|
|
var rows=opts.finder.getRows(_144);
|
|
if(!_145&&opts.selectOnCheck){
|
|
_126(_144,true);
|
|
}
|
|
var dc=_146.dc;
|
|
var hck=dc.header1.add(dc.header2).find("input[type=checkbox]");
|
|
var bck=opts.finder.getTr(_144,"","checked").removeClass("datagrid-row-checked").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++){
|
|
_3(_146.checkedRows,opts.idField,rows[i][opts.idField]);
|
|
}
|
|
}
|
|
opts.onUncheckAll.call(_144,rows);
|
|
};
|
|
function _147(_148,_149){
|
|
var opts=$.data(_148,"datagrid").options;
|
|
var tr=opts.finder.getTr(_148,_149);
|
|
var row=opts.finder.getRow(_148,_149);
|
|
if(tr.hasClass("datagrid-row-editing")){
|
|
return;
|
|
}
|
|
if(opts.onBeforeEdit.apply(_148,_5(_148,[_149,row]))==false){
|
|
return;
|
|
}
|
|
tr.addClass("datagrid-row-editing");
|
|
_14a(_148,_149);
|
|
_e6(_148);
|
|
tr.find("div.datagrid-editable").each(function(){
|
|
var _14b=$(this).parent().attr("field");
|
|
var ed=$.data(this,"datagrid.editor");
|
|
ed.actions.setValue(ed.target,row[_14b]);
|
|
});
|
|
_14c(_148,_149);
|
|
opts.onBeginEdit.apply(_148,_5(_148,[_149,row]));
|
|
};
|
|
function _14d(_14e,_14f,_150){
|
|
var _151=$.data(_14e,"datagrid");
|
|
var opts=_151.options;
|
|
var _152=_151.updatedRows;
|
|
var _153=_151.insertedRows;
|
|
var tr=opts.finder.getTr(_14e,_14f);
|
|
var row=opts.finder.getRow(_14e,_14f);
|
|
if(!tr.hasClass("datagrid-row-editing")){
|
|
return;
|
|
}
|
|
if(!_150){
|
|
if(!_14c(_14e,_14f)){
|
|
return;
|
|
}
|
|
var _154=false;
|
|
var _155={};
|
|
tr.find("div.datagrid-editable").each(function(){
|
|
var _156=$(this).parent().attr("field");
|
|
var ed=$.data(this,"datagrid.editor");
|
|
var t=$(ed.target);
|
|
var _157=t.data("textbox")?t.textbox("textbox"):t;
|
|
_157.triggerHandler("blur");
|
|
var _158=ed.actions.getValue(ed.target);
|
|
if(row[_156]!==_158){
|
|
row[_156]=_158;
|
|
_154=true;
|
|
_155[_156]=_158;
|
|
}
|
|
});
|
|
if(_154){
|
|
if(_2(_153,row)==-1){
|
|
if(_2(_152,row)==-1){
|
|
_152.push(row);
|
|
}
|
|
}
|
|
}
|
|
opts.onEndEdit.apply(_14e,_5(_14e,[_14f,row,_155]));
|
|
}
|
|
tr.removeClass("datagrid-row-editing");
|
|
_159(_14e,_14f);
|
|
$(_14e).datagrid("refreshRow",_14f);
|
|
if(!_150){
|
|
opts.onAfterEdit.apply(_14e,_5(_14e,[_14f,row,_155]));
|
|
}else{
|
|
opts.onCancelEdit.apply(_14e,_5(_14e,[_14f,row]));
|
|
}
|
|
};
|
|
function _15a(_15b,_15c){
|
|
var opts=$.data(_15b,"datagrid").options;
|
|
var tr=opts.finder.getTr(_15b,_15c);
|
|
var _15d=[];
|
|
tr.children("td").each(function(){
|
|
var cell=$(this).find("div.datagrid-editable");
|
|
if(cell.length){
|
|
var ed=$.data(cell[0],"datagrid.editor");
|
|
_15d.push(ed);
|
|
}
|
|
});
|
|
return _15d;
|
|
};
|
|
function _15e(_15f,_160){
|
|
var _161=_15a(_15f,_160.index!=undefined?_160.index:_160.id);
|
|
for(var i=0;i<_161.length;i++){
|
|
if(_161[i].field==_160.field){
|
|
return _161[i];
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
function _14a(_162,_163){
|
|
var opts=$.data(_162,"datagrid").options;
|
|
var tr=opts.finder.getTr(_162,_163);
|
|
tr.children("td").each(function(){
|
|
var cell=$(this).find("div.datagrid-cell");
|
|
var _164=$(this).attr("field");
|
|
var col=_73(_162,_164);
|
|
if(col&&col.editor){
|
|
var _165,_166;
|
|
if(typeof col.editor=="string"){
|
|
_165=col.editor;
|
|
}else{
|
|
_165=col.editor.type;
|
|
_166=col.editor.options;
|
|
}
|
|
var _167=opts.editors[_165];
|
|
if(_167){
|
|
var _168=cell.html();
|
|
var _169=cell._outerWidth();
|
|
cell.addClass("datagrid-editable");
|
|
cell._outerWidth(_169);
|
|
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:_167,target:_167.init(cell.find("td"),_166),field:_164,type:_165,oldHtml:_168});
|
|
}
|
|
}
|
|
});
|
|
_34(_162,_163,true);
|
|
};
|
|
function _159(_16a,_16b){
|
|
var opts=$.data(_16a,"datagrid").options;
|
|
var tr=opts.finder.getTr(_16a,_16b);
|
|
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 _14c(_16c,_16d){
|
|
var tr=$.data(_16c,"datagrid").options.finder.getTr(_16c,_16d);
|
|
if(!tr.hasClass("datagrid-row-editing")){
|
|
return true;
|
|
}
|
|
var vbox=tr.find(".validatebox-text");
|
|
vbox.validatebox("validate");
|
|
vbox.trigger("mouseleave");
|
|
var _16e=tr.find(".validatebox-invalid");
|
|
return _16e.length==0;
|
|
};
|
|
function _16f(_170,_171){
|
|
var _172=$.data(_170,"datagrid").insertedRows;
|
|
var _173=$.data(_170,"datagrid").deletedRows;
|
|
var _174=$.data(_170,"datagrid").updatedRows;
|
|
if(!_171){
|
|
var rows=[];
|
|
rows=rows.concat(_172);
|
|
rows=rows.concat(_173);
|
|
rows=rows.concat(_174);
|
|
return rows;
|
|
}else{
|
|
if(_171=="inserted"){
|
|
return _172;
|
|
}else{
|
|
if(_171=="deleted"){
|
|
return _173;
|
|
}else{
|
|
if(_171=="updated"){
|
|
return _174;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return [];
|
|
};
|
|
function _175(_176,_177){
|
|
var _178=$.data(_176,"datagrid");
|
|
var opts=_178.options;
|
|
var data=_178.data;
|
|
var _179=_178.insertedRows;
|
|
var _17a=_178.deletedRows;
|
|
$(_176).datagrid("cancelEdit",_177);
|
|
var row=opts.finder.getRow(_176,_177);
|
|
if(_2(_179,row)>=0){
|
|
_3(_179,row);
|
|
}else{
|
|
_17a.push(row);
|
|
}
|
|
_3(_178.selectedRows,opts.idField,row[opts.idField]);
|
|
_3(_178.checkedRows,opts.idField,row[opts.idField]);
|
|
opts.view.deleteRow.call(opts.view,_176,_177);
|
|
if(opts.height=="auto"){
|
|
_34(_176);
|
|
}
|
|
$(_176).datagrid("getPager").pagination("refresh",{total:data.total});
|
|
};
|
|
function _17b(_17c,_17d){
|
|
var data=$.data(_17c,"datagrid").data;
|
|
var view=$.data(_17c,"datagrid").options.view;
|
|
var _17e=$.data(_17c,"datagrid").insertedRows;
|
|
view.insertRow.call(view,_17c,_17d.index,_17d.row);
|
|
_17e.push(_17d.row);
|
|
$(_17c).datagrid("getPager").pagination("refresh",{total:data.total});
|
|
};
|
|
function _17f(_180,row){
|
|
var data=$.data(_180,"datagrid").data;
|
|
var view=$.data(_180,"datagrid").options.view;
|
|
var _181=$.data(_180,"datagrid").insertedRows;
|
|
view.insertRow.call(view,_180,null,row);
|
|
_181.push(row);
|
|
$(_180).datagrid("getPager").pagination("refresh",{total:data.total});
|
|
};
|
|
function _182(_183,_184){
|
|
var _185=$.data(_183,"datagrid");
|
|
var opts=_185.options;
|
|
var row=opts.finder.getRow(_183,_184.index);
|
|
var _186=false;
|
|
_184.row=_184.row||{};
|
|
for(var _187 in _184.row){
|
|
if(row[_187]!==_184.row[_187]){
|
|
_186=true;
|
|
break;
|
|
}
|
|
}
|
|
if(_186){
|
|
if(_2(_185.insertedRows,row)==-1){
|
|
if(_2(_185.updatedRows,row)==-1){
|
|
_185.updatedRows.push(row);
|
|
}
|
|
}
|
|
opts.view.updateRow.call(opts.view,_183,_184.index,_184.row);
|
|
}
|
|
};
|
|
function _188(_189){
|
|
var _18a=$.data(_189,"datagrid");
|
|
var data=_18a.data;
|
|
var rows=data.rows;
|
|
var _18b=[];
|
|
for(var i=0;i<rows.length;i++){
|
|
_18b.push($.extend({},rows[i]));
|
|
}
|
|
_18a.originalRows=_18b;
|
|
_18a.updatedRows=[];
|
|
_18a.insertedRows=[];
|
|
_18a.deletedRows=[];
|
|
};
|
|
function _18c(_18d){
|
|
var data=$.data(_18d,"datagrid").data;
|
|
var ok=true;
|
|
for(var i=0,len=data.rows.length;i<len;i++){
|
|
if(_14c(_18d,i)){
|
|
$(_18d).datagrid("endEdit",i);
|
|
}else{
|
|
ok=false;
|
|
}
|
|
}
|
|
if(ok){
|
|
_188(_18d);
|
|
}
|
|
};
|
|
function _18e(_18f){
|
|
var _190=$.data(_18f,"datagrid");
|
|
var opts=_190.options;
|
|
var _191=_190.originalRows;
|
|
var _192=_190.insertedRows;
|
|
var _193=_190.deletedRows;
|
|
var _194=_190.selectedRows;
|
|
var _195=_190.checkedRows;
|
|
var data=_190.data;
|
|
function _196(a){
|
|
var ids=[];
|
|
for(var i=0;i<a.length;i++){
|
|
ids.push(a[i][opts.idField]);
|
|
}
|
|
return ids;
|
|
};
|
|
function _197(ids,_198){
|
|
for(var i=0;i<ids.length;i++){
|
|
var _199=_10f(_18f,ids[i]);
|
|
if(_199>=0){
|
|
(_198=="s"?_94:_91)(_18f,_199,true);
|
|
}
|
|
}
|
|
};
|
|
for(var i=0;i<data.rows.length;i++){
|
|
$(_18f).datagrid("cancelEdit",i);
|
|
}
|
|
var _19a=_196(_194);
|
|
var _19b=_196(_195);
|
|
_194.splice(0,_194.length);
|
|
_195.splice(0,_195.length);
|
|
data.total+=_193.length-_192.length;
|
|
data.rows=_191;
|
|
_b0(_18f,data);
|
|
_197(_19a,"s");
|
|
_197(_19b,"c");
|
|
_188(_18f);
|
|
};
|
|
function _af(_19c,_19d,cb){
|
|
var opts=$.data(_19c,"datagrid").options;
|
|
if(_19d){
|
|
opts.queryParams=_19d;
|
|
}
|
|
var _19e=$.extend({},opts.queryParams);
|
|
if(opts.pagination){
|
|
$.extend(_19e,{page:opts.pageNumber||1,rows:opts.pageSize});
|
|
}
|
|
if(opts.sortName){
|
|
$.extend(_19e,{sort:opts.sortName,order:opts.sortOrder});
|
|
}
|
|
if(opts.onBeforeLoad.call(_19c,_19e)==false){
|
|
return;
|
|
}
|
|
$(_19c).datagrid("loading");
|
|
var _19f=opts.loader.call(_19c,_19e,function(data){
|
|
$(_19c).datagrid("loaded");
|
|
$(_19c).datagrid("loadData",data);
|
|
if(cb){
|
|
cb();
|
|
}
|
|
},function(){
|
|
$(_19c).datagrid("loaded");
|
|
opts.onLoadError.apply(_19c,arguments);
|
|
});
|
|
if(_19f==false){
|
|
$(_19c).datagrid("loaded");
|
|
}
|
|
};
|
|
function _1a0(_1a1,_1a2){
|
|
var opts=$.data(_1a1,"datagrid").options;
|
|
_1a2.type=_1a2.type||"body";
|
|
_1a2.rowspan=_1a2.rowspan||1;
|
|
_1a2.colspan=_1a2.colspan||1;
|
|
if(_1a2.rowspan==1&&_1a2.colspan==1){
|
|
return;
|
|
}
|
|
var tr=opts.finder.getTr(_1a1,(_1a2.index!=undefined?_1a2.index:_1a2.id),_1a2.type);
|
|
if(!tr.length){
|
|
return;
|
|
}
|
|
var td=tr.find("td[field=\""+_1a2.field+"\"]");
|
|
td.attr("rowspan",_1a2.rowspan).attr("colspan",_1a2.colspan);
|
|
td.addClass("datagrid-td-merged");
|
|
_1a3(td.next(),_1a2.colspan-1);
|
|
for(var i=1;i<_1a2.rowspan;i++){
|
|
tr=tr.next();
|
|
if(!tr.length){
|
|
break;
|
|
}
|
|
td=tr.find("td[field=\""+_1a2.field+"\"]");
|
|
_1a3(td,_1a2.colspan);
|
|
}
|
|
_e5(_1a1);
|
|
function _1a3(td,_1a4){
|
|
for(var i=0;i<_1a4;i++){
|
|
td.hide();
|
|
td=td.next();
|
|
}
|
|
};
|
|
};
|
|
$.fn.datagrid=function(_1a5,_1a6){
|
|
if(typeof _1a5=="string"){
|
|
return $.fn.datagrid.methods[_1a5](this,_1a6);
|
|
}
|
|
_1a5=_1a5||{};
|
|
return this.each(function(){
|
|
var _1a7=$.data(this,"datagrid");
|
|
var opts;
|
|
if(_1a7){
|
|
opts=$.extend(_1a7.options,_1a5);
|
|
_1a7.options=opts;
|
|
}else{
|
|
opts=$.extend({},$.extend({},$.fn.datagrid.defaults,{queryParams:{}}),$.fn.datagrid.parseOptions(this),_1a5);
|
|
$(this).css("width","").css("height","");
|
|
var _1a8=_4d(this,opts.rownumbers);
|
|
if(!opts.columns){
|
|
opts.columns=_1a8.columns;
|
|
}
|
|
if(!opts.frozenColumns){
|
|
opts.frozenColumns=_1a8.frozenColumns;
|
|
}
|
|
opts.columns=$.extend(true,[],opts.columns);
|
|
opts.frozenColumns=$.extend(true,[],opts.frozenColumns);
|
|
opts.view=$.extend({},opts.view);
|
|
$.data(this,"datagrid",{options:opts,panel:_1a8.panel,dc:_1a8.dc,ss:null,selectedRows:[],checkedRows:[],data:{total:0,rows:[]},originalRows:[],updatedRows:[],insertedRows:[],deletedRows:[]});
|
|
}
|
|
_58(this);
|
|
_74(this);
|
|
_1a(this);
|
|
if(opts.data){
|
|
$(this).datagrid("loadData",opts.data);
|
|
}else{
|
|
var data=$.fn.datagrid.parseData(this);
|
|
if(data.total>0){
|
|
$(this).datagrid("loadData",data);
|
|
}else{
|
|
opts.view.renderEmptyRow(this);
|
|
$(this).datagrid("autoSizeColumn");
|
|
}
|
|
}
|
|
_af(this);
|
|
});
|
|
};
|
|
function _1a9(_1aa){
|
|
var _1ab={};
|
|
$.map(_1aa,function(name){
|
|
_1ab[name]=_1ac(name);
|
|
});
|
|
return _1ab;
|
|
function _1ac(name){
|
|
function isA(_1ad){
|
|
return $.data($(_1ad)[0],name)!=undefined;
|
|
};
|
|
return {init:function(_1ae,_1af){
|
|
var _1b0=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_1ae);
|
|
if(_1b0[name]&&name!="text"){
|
|
return _1b0[name](_1af);
|
|
}else{
|
|
return _1b0;
|
|
}
|
|
},destroy:function(_1b1){
|
|
if(isA(_1b1,name)){
|
|
$(_1b1)[name]("destroy");
|
|
}
|
|
},getValue:function(_1b2){
|
|
if(isA(_1b2,name)){
|
|
var opts=$(_1b2)[name]("options");
|
|
if(opts.multiple){
|
|
return $(_1b2)[name]("getValues").join(opts.separator);
|
|
}else{
|
|
return $(_1b2)[name]("getValue");
|
|
}
|
|
}else{
|
|
return $(_1b2).val();
|
|
}
|
|
},setValue:function(_1b3,_1b4){
|
|
if(isA(_1b3,name)){
|
|
var opts=$(_1b3)[name]("options");
|
|
if(opts.multiple){
|
|
if(_1b4){
|
|
$(_1b3)[name]("setValues",_1b4.split(opts.separator));
|
|
}else{
|
|
$(_1b3)[name]("clear");
|
|
}
|
|
}else{
|
|
$(_1b3)[name]("setValue",_1b4);
|
|
}
|
|
}else{
|
|
$(_1b3).val(_1b4);
|
|
}
|
|
},resize:function(_1b5,_1b6){
|
|
if(isA(_1b5,name)){
|
|
$(_1b5)[name]("resize",_1b6);
|
|
}else{
|
|
$(_1b5)._outerWidth(_1b6)._outerHeight(22);
|
|
}
|
|
}};
|
|
};
|
|
};
|
|
var _1b7=$.extend({},_1a9(["text","textbox","numberbox","numberspinner","combobox","combotree","combogrid","datebox","datetimebox","timespinner","datetimespinner"]),{textarea:{init:function(_1b8,_1b9){
|
|
var _1ba=$("<textarea class=\"datagrid-editable-input\"></textarea>").appendTo(_1b8);
|
|
return _1ba;
|
|
},getValue:function(_1bb){
|
|
return $(_1bb).val();
|
|
},setValue:function(_1bc,_1bd){
|
|
$(_1bc).val(_1bd);
|
|
},resize:function(_1be,_1bf){
|
|
$(_1be)._outerWidth(_1bf);
|
|
}},checkbox:{init:function(_1c0,_1c1){
|
|
var _1c2=$("<input type=\"checkbox\">").appendTo(_1c0);
|
|
_1c2.val(_1c1.on);
|
|
_1c2.attr("offval",_1c1.off);
|
|
return _1c2;
|
|
},getValue:function(_1c3){
|
|
if($(_1c3).is(":checked")){
|
|
return $(_1c3).val();
|
|
}else{
|
|
return $(_1c3).attr("offval");
|
|
}
|
|
},setValue:function(_1c4,_1c5){
|
|
var _1c6=false;
|
|
if($(_1c4).val()==_1c5){
|
|
_1c6=true;
|
|
}
|
|
$(_1c4)._propAttr("checked",_1c6);
|
|
}},validatebox:{init:function(_1c7,_1c8){
|
|
var _1c9=$("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_1c7);
|
|
_1c9.validatebox(_1c8);
|
|
return _1c9;
|
|
},destroy:function(_1ca){
|
|
$(_1ca).validatebox("destroy");
|
|
},getValue:function(_1cb){
|
|
return $(_1cb).val();
|
|
},setValue:function(_1cc,_1cd){
|
|
$(_1cc).val(_1cd);
|
|
},resize:function(_1ce,_1cf){
|
|
$(_1ce)._outerWidth(_1cf)._outerHeight(22);
|
|
}}});
|
|
$.fn.datagrid.methods={options:function(jq){
|
|
var _1d0=$.data(jq[0],"datagrid").options;
|
|
var _1d1=$.data(jq[0],"datagrid").panel.panel("options");
|
|
var opts=$.extend(_1d0,{width:_1d1.width,height:_1d1.height,closed:_1d1.closed,collapsed:_1d1.collapsed,minimized:_1d1.minimized,maximized:_1d1.maximized});
|
|
return opts;
|
|
},setSelectionState:function(jq){
|
|
return jq.each(function(){
|
|
_107(this);
|
|
});
|
|
},createStyleSheet:function(jq){
|
|
return _7(jq[0]);
|
|
},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,_1d2){
|
|
return _72(jq[0],_1d2);
|
|
},getColumnOption:function(jq,_1d3){
|
|
return _73(jq[0],_1d3);
|
|
},resize:function(jq,_1d4){
|
|
return jq.each(function(){
|
|
_1a(this,_1d4);
|
|
});
|
|
},load:function(jq,_1d5){
|
|
return jq.each(function(){
|
|
var opts=$(this).datagrid("options");
|
|
if(typeof _1d5=="string"){
|
|
opts.url=_1d5;
|
|
_1d5=null;
|
|
}
|
|
opts.pageNumber=1;
|
|
var _1d6=$(this).datagrid("getPager");
|
|
_1d6.pagination("refresh",{pageNumber:1});
|
|
_af(this,_1d5);
|
|
});
|
|
},reload:function(jq,_1d7){
|
|
return jq.each(function(){
|
|
var opts=$(this).datagrid("options");
|
|
if(typeof _1d7=="string"){
|
|
opts.url=_1d7;
|
|
_1d7=null;
|
|
}
|
|
_af(this,_1d7);
|
|
});
|
|
},reloadFooter:function(jq,_1d8){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
var dc=$.data(this,"datagrid").dc;
|
|
if(_1d8){
|
|
$.data(this,"datagrid").footer=_1d8;
|
|
}
|
|
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 _1d9=$(this).datagrid("getPanel");
|
|
if(!_1d9.children("div.datagrid-mask").length){
|
|
$("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo(_1d9);
|
|
var msg=$("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(opts.loadMsg).appendTo(_1d9);
|
|
msg._outerHeight(40);
|
|
msg.css({marginLeft:(-msg.outerWidth()/2),lineHeight:(msg.height()+"px")});
|
|
}
|
|
}
|
|
});
|
|
},loaded:function(jq){
|
|
return jq.each(function(){
|
|
$(this).datagrid("getPager").pagination("loaded");
|
|
var _1da=$(this).datagrid("getPanel");
|
|
_1da.children("div.datagrid-mask-msg").remove();
|
|
_1da.children("div.datagrid-mask").remove();
|
|
});
|
|
},fitColumns:function(jq){
|
|
return jq.each(function(){
|
|
_bc(this);
|
|
});
|
|
},fixColumnSize:function(jq,_1db){
|
|
return jq.each(function(){
|
|
_df(this,_1db);
|
|
});
|
|
},fixRowHeight:function(jq,_1dc){
|
|
return jq.each(function(){
|
|
_34(this,_1dc);
|
|
});
|
|
},freezeRow:function(jq,_1dd){
|
|
return jq.each(function(){
|
|
_45(this,_1dd);
|
|
});
|
|
},autoSizeColumn:function(jq,_1de){
|
|
return jq.each(function(){
|
|
_d0(this,_1de);
|
|
});
|
|
},loadData:function(jq,data){
|
|
return jq.each(function(){
|
|
_b0(this,data);
|
|
_188(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 _10f(jq[0],id);
|
|
},getChecked:function(jq){
|
|
return _115(jq[0]);
|
|
},getSelected:function(jq){
|
|
var rows=_112(jq[0]);
|
|
return rows.length>0?rows[0]:null;
|
|
},getSelections:function(jq){
|
|
return _112(jq[0]);
|
|
},clearSelections:function(jq){
|
|
return jq.each(function(){
|
|
var _1df=$.data(this,"datagrid");
|
|
var _1e0=_1df.selectedRows;
|
|
var _1e1=_1df.checkedRows;
|
|
_1e0.splice(0,_1e0.length);
|
|
_126(this);
|
|
if(_1df.options.checkOnSelect){
|
|
_1e1.splice(0,_1e1.length);
|
|
}
|
|
});
|
|
},clearChecked:function(jq){
|
|
return jq.each(function(){
|
|
var _1e2=$.data(this,"datagrid");
|
|
var _1e3=_1e2.selectedRows;
|
|
var _1e4=_1e2.checkedRows;
|
|
_1e4.splice(0,_1e4.length);
|
|
_136(this);
|
|
if(_1e2.options.selectOnCheck){
|
|
_1e3.splice(0,_1e3.length);
|
|
}
|
|
});
|
|
},scrollTo:function(jq,_1e5){
|
|
return jq.each(function(){
|
|
_118(this,_1e5);
|
|
});
|
|
},highlightRow:function(jq,_1e6){
|
|
return jq.each(function(){
|
|
_8b(this,_1e6);
|
|
_118(this,_1e6);
|
|
});
|
|
},selectAll:function(jq){
|
|
return jq.each(function(){
|
|
_12b(this);
|
|
});
|
|
},unselectAll:function(jq){
|
|
return jq.each(function(){
|
|
_126(this);
|
|
});
|
|
},selectRow:function(jq,_1e7){
|
|
return jq.each(function(){
|
|
_94(this,_1e7);
|
|
});
|
|
},selectRecord:function(jq,id){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
if(opts.idField){
|
|
var _1e8=_10f(this,id);
|
|
if(_1e8>=0){
|
|
$(this).datagrid("selectRow",_1e8);
|
|
}
|
|
}
|
|
});
|
|
},unselectRow:function(jq,_1e9){
|
|
return jq.each(function(){
|
|
_95(this,_1e9);
|
|
});
|
|
},checkRow:function(jq,_1ea){
|
|
return jq.each(function(){
|
|
_91(this,_1ea);
|
|
});
|
|
},uncheckRow:function(jq,_1eb){
|
|
return jq.each(function(){
|
|
_92(this,_1eb);
|
|
});
|
|
},checkAll:function(jq){
|
|
return jq.each(function(){
|
|
_130(this);
|
|
});
|
|
},uncheckAll:function(jq){
|
|
return jq.each(function(){
|
|
_136(this);
|
|
});
|
|
},beginEdit:function(jq,_1ec){
|
|
return jq.each(function(){
|
|
_147(this,_1ec);
|
|
});
|
|
},endEdit:function(jq,_1ed){
|
|
return jq.each(function(){
|
|
_14d(this,_1ed,false);
|
|
});
|
|
},cancelEdit:function(jq,_1ee){
|
|
return jq.each(function(){
|
|
_14d(this,_1ee,true);
|
|
});
|
|
},getEditors:function(jq,_1ef){
|
|
return _15a(jq[0],_1ef);
|
|
},getEditor:function(jq,_1f0){
|
|
return _15e(jq[0],_1f0);
|
|
},refreshRow:function(jq,_1f1){
|
|
return jq.each(function(){
|
|
var opts=$.data(this,"datagrid").options;
|
|
opts.view.refreshRow.call(opts.view,this,_1f1);
|
|
});
|
|
},validateRow:function(jq,_1f2){
|
|
return _14c(jq[0],_1f2);
|
|
},updateRow:function(jq,_1f3){
|
|
return jq.each(function(){
|
|
_182(this,_1f3);
|
|
});
|
|
},appendRow:function(jq,row){
|
|
return jq.each(function(){
|
|
_17f(this,row);
|
|
});
|
|
},insertRow:function(jq,_1f4){
|
|
return jq.each(function(){
|
|
_17b(this,_1f4);
|
|
});
|
|
},deleteRow:function(jq,_1f5){
|
|
return jq.each(function(){
|
|
_175(this,_1f5);
|
|
});
|
|
},getChanges:function(jq,_1f6){
|
|
return _16f(jq[0],_1f6);
|
|
},acceptChanges:function(jq){
|
|
return jq.each(function(){
|
|
_18c(this);
|
|
});
|
|
},rejectChanges:function(jq){
|
|
return jq.each(function(){
|
|
_18e(this);
|
|
});
|
|
},mergeCells:function(jq,_1f7){
|
|
return jq.each(function(){
|
|
_1a0(this,_1f7);
|
|
});
|
|
},showColumn:function(jq,_1f8){
|
|
return jq.each(function(){
|
|
var col=$(this).datagrid("getColumnOption",_1f8);
|
|
if(col.hidden){
|
|
col.hidden=false;
|
|
$(this).datagrid("getPanel").find("td[field=\""+_1f8+"\"]").show();
|
|
_b1(this,_1f8,1);
|
|
$(this).datagrid("fitColumns");
|
|
}
|
|
});
|
|
},hideColumn:function(jq,_1f9){
|
|
return jq.each(function(){
|
|
var col=$(this).datagrid("getColumnOption",_1f9);
|
|
if(!col.hidden){
|
|
col.hidden=true;
|
|
$(this).datagrid("getPanel").find("td[field=\""+_1f9+"\"]").hide();
|
|
_b1(this,_1f9,-1);
|
|
$(this).datagrid("fitColumns");
|
|
}
|
|
});
|
|
},sort:function(jq,_1fa){
|
|
return jq.each(function(){
|
|
_a3(this,_1fa);
|
|
});
|
|
},gotoPage:function(jq,_1fb){
|
|
return jq.each(function(){
|
|
var _1fc=this;
|
|
var page,cb;
|
|
if(typeof _1fb=="object"){
|
|
page=_1fb.page;
|
|
cb=_1fb.callback;
|
|
}else{
|
|
page=_1fb;
|
|
}
|
|
$(_1fc).datagrid("options").pageNumber=page;
|
|
$(_1fc).datagrid("getPager").pagination("refresh",{pageNumber:page});
|
|
_af(_1fc,null,function(){
|
|
if(cb){
|
|
cb.call(_1fc,page);
|
|
}
|
|
});
|
|
});
|
|
}};
|
|
$.fn.datagrid.parseOptions=function(_1fd){
|
|
var t=$(_1fd);
|
|
return $.extend({},$.fn.panel.parseOptions(_1fd),$.parser.parseOptions(_1fd,["url","toolbar","idField","sortName","sortOrder","pagePosition","resizeHandle",{sharedStyleSheet:"boolean",fitColumns:"boolean",autoRowHeight:"boolean",striped:"boolean",nowrap:"boolean"},{rownumbers:"boolean",singleSelect:"boolean",ctrlSelect:"boolean",checkOnSelect:"boolean",selectOnCheck:"boolean"},{pagination:"boolean",pageSize:"number",pageNumber:"number"},{multiSort:"boolean",remoteSort:"boolean",showHeader:"boolean",showFooter:"boolean"},{scrollbarSize:"number"}]),{pageList:(t.attr("pageList")?cceval(t.attr("pageList")):undefined),loadMsg:(t.attr("loadMsg")!=undefined?t.attr("loadMsg"):undefined),rowStyler:(t.attr("rowStyler")?cceval(t.attr("rowStyler")):undefined)});
|
|
};
|
|
$.fn.datagrid.parseData=function(_1fe){
|
|
var t=$(_1fe);
|
|
var data={total:0,rows:[]};
|
|
var _1ff=t.datagrid("getColumnFields",true).concat(t.datagrid("getColumnFields",false));
|
|
t.find("tbody tr").each(function(){
|
|
data.total++;
|
|
var row={};
|
|
$.extend(row,$.parser.parseOptions(this,["iconCls","state"]));
|
|
for(var i=0;i<_1ff.length;i++){
|
|
row[_1ff[i]]=$(this).find("td:eq("+i+")").html();
|
|
}
|
|
data.rows.push(row);
|
|
});
|
|
return data;
|
|
};
|
|
var _200={render:function(_201,_202,_203){
|
|
var rows=$(_201).datagrid("getRows");
|
|
$(_202).html(this.renderTable(_201,0,rows,_203));
|
|
},renderFooter:function(_204,_205,_206){
|
|
var opts=$.data(_204,"datagrid").options;
|
|
var rows=$.data(_204,"datagrid").footer||[];
|
|
var _207=$(_204).datagrid("getColumnFields",_206);
|
|
var _208=["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<rows.length;i++){
|
|
_208.push("<tr class=\"datagrid-row\" datagrid-row-index=\""+i+"\">");
|
|
_208.push(this.renderRow.call(this,_204,_207,_206,i,rows[i]));
|
|
_208.push("</tr>");
|
|
}
|
|
_208.push("</tbody></table>");
|
|
$(_205).html(_208.join(""));
|
|
},renderTable:function(_209,_20a,rows,_20b){
|
|
var _20c=$.data(_209,"datagrid");
|
|
var opts=_20c.options;
|
|
if(_20b){
|
|
if(!(opts.rownumbers||(opts.frozenColumns&&opts.frozenColumns.length))){
|
|
return "";
|
|
}
|
|
}
|
|
var _20d=$(_209).datagrid("getColumnFields",_20b);
|
|
var _20e=["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
|
|
for(var i=0;i<rows.length;i++){
|
|
var row=rows[i];
|
|
var css=opts.rowStyler?opts.rowStyler.call(_209,_20a,row):"";
|
|
var cs=this.getStyleValue(css);
|
|
var cls="class=\"datagrid-row "+(_20a%2&&opts.striped?"datagrid-row-alt ":" ")+cs.c+"\"";
|
|
var _20f=cs.s?"style=\""+cs.s+"\"":"";
|
|
var _210=_20c.rowIdPrefix+"-"+(_20b?1:2)+"-"+_20a;
|
|
_20e.push("<tr id=\""+_210+"\" datagrid-row-index=\""+_20a+"\" "+cls+" "+_20f+">");
|
|
_20e.push(this.renderRow.call(this,_209,_20d,_20b,_20a,row));
|
|
_20e.push("</tr>");
|
|
_20a++;
|
|
}
|
|
_20e.push("</tbody></table>");
|
|
return _20e.join("");
|
|
},renderRow:function(_211,_212,_213,_214,_215){
|
|
var opts=$.data(_211,"datagrid").options;
|
|
var cc=[];
|
|
if(_213&&opts.rownumbers){
|
|
var _216=_214+1;
|
|
if(opts.pagination){
|
|
_216+=(opts.pageNumber-1)*opts.pageSize;
|
|
}
|
|
cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">"+_216+"</div></td>");
|
|
}
|
|
for(var i=0;i<_212.length;i++){
|
|
var _217=_212[i];
|
|
var col=$(_211).datagrid("getColumnOption",_217);
|
|
if(col){
|
|
var _218=_215[_217];
|
|
var css=col.styler?(col.styler(_218,_215,_214)||""):"";
|
|
var cs=this.getStyleValue(css);
|
|
var cls=cs.c?"class=\""+cs.c+"\"":"";
|
|
var _219=col.hidden?"style=\"display:none;"+cs.s+"\"":(cs.s?"style=\""+cs.s+"\"":"");
|
|
cc.push("<td field=\""+_217+"\" "+cls+" "+_219+">");
|
|
var _219="";
|
|
if(!col.checkbox){
|
|
if(col.align){
|
|
_219+="text-align:"+col.align+";";
|
|
}
|
|
if(!opts.nowrap){
|
|
_219+="white-space:normal;height:auto;";
|
|
}else{
|
|
if(opts.autoRowHeight){
|
|
_219+="height:auto;";
|
|
}
|
|
}
|
|
}
|
|
cc.push("<div style=\""+_219+"\" ");
|
|
cc.push(col.checkbox?"class=\"datagrid-cell-check\"":"class=\"datagrid-cell "+col.cellClass+"\"");
|
|
cc.push(">");
|
|
if(col.checkbox){
|
|
cc.push("<input type=\"checkbox\" "+(_215.checked?"checked=\"checked\"":""));
|
|
cc.push(" name=\""+_217+"\" value=\""+(_218!=undefined?_218:"")+"\">");
|
|
}else{
|
|
if(col.formatter){
|
|
cc.push(col.formatter(_218,_215,_214));
|
|
}else{
|
|
cc.push(_218);
|
|
}
|
|
}
|
|
cc.push("</div>");
|
|
cc.push("</td>");
|
|
}
|
|
}
|
|
return cc.join("");
|
|
},getStyleValue:function(css){
|
|
var _21a="";
|
|
var _21b="";
|
|
if(typeof css=="string"){
|
|
_21b=css;
|
|
}else{
|
|
if(css){
|
|
_21a=css["class"]||"";
|
|
_21b=css["style"]||"";
|
|
}
|
|
}
|
|
return {c:_21a,s:_21b};
|
|
},refreshRow:function(_21c,_21d){
|
|
this.updateRow.call(this,_21c,_21d,{});
|
|
},updateRow:function(_21e,_21f,row){
|
|
var opts=$.data(_21e,"datagrid").options;
|
|
var _220=opts.finder.getRow(_21e,_21f);
|
|
var _221=_222.call(this,_21f);
|
|
$.extend(_220,row);
|
|
var _223=_222.call(this,_21f);
|
|
var _224=_221.c;
|
|
var _225=_223.s;
|
|
var _226="datagrid-row "+(_21f%2&&opts.striped?"datagrid-row-alt ":" ")+_223.c;
|
|
function _222(_227){
|
|
var css=opts.rowStyler?opts.rowStyler.call(_21e,_227,_220):"";
|
|
return this.getStyleValue(css);
|
|
};
|
|
function _228(_229){
|
|
var _22a=$(_21e).datagrid("getColumnFields",_229);
|
|
var tr=opts.finder.getTr(_21e,_21f,"body",(_229?1:2));
|
|
var _22b=tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
|
|
tr.html(this.renderRow.call(this,_21e,_22a,_229,_21f,_220));
|
|
tr.attr("style",_225).removeClass(_224).addClass(_226);
|
|
if(_22b){
|
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked",true);
|
|
}
|
|
};
|
|
_228.call(this,true);
|
|
_228.call(this,false);
|
|
$(_21e).datagrid("fixRowHeight",_21f);
|
|
},insertRow:function(_22c,_22d,row){
|
|
var _22e=$.data(_22c,"datagrid");
|
|
var opts=_22e.options;
|
|
var dc=_22e.dc;
|
|
var data=_22e.data;
|
|
if(_22d==undefined||_22d==null){
|
|
_22d=data.rows.length;
|
|
}
|
|
if(_22d>data.rows.length){
|
|
_22d=data.rows.length;
|
|
}
|
|
function _22f(_230){
|
|
var _231=_230?1:2;
|
|
for(var i=data.rows.length-1;i>=_22d;i--){
|
|
var tr=opts.finder.getTr(_22c,i,"body",_231);
|
|
tr.attr("datagrid-row-index",i+1);
|
|
tr.attr("id",_22e.rowIdPrefix+"-"+_231+"-"+(i+1));
|
|
if(_230&&opts.rownumbers){
|
|
var _232=i+2;
|
|
if(opts.pagination){
|
|
_232+=(opts.pageNumber-1)*opts.pageSize;
|
|
}
|
|
tr.find("div.datagrid-cell-rownumber").html(_232);
|
|
}
|
|
if(opts.striped){
|
|
tr.removeClass("datagrid-row-alt").addClass((i+1)%2?"datagrid-row-alt":"");
|
|
}
|
|
}
|
|
};
|
|
function _233(_234){
|
|
var _235=_234?1:2;
|
|
var _236=$(_22c).datagrid("getColumnFields",_234);
|
|
var _237=_22e.rowIdPrefix+"-"+_235+"-"+_22d;
|
|
var tr="<tr id=\""+_237+"\" class=\"datagrid-row\" datagrid-row-index=\""+_22d+"\"></tr>";
|
|
if(_22d>=data.rows.length){
|
|
if(data.rows.length){
|
|
opts.finder.getTr(_22c,"","last",_235).after(tr);
|
|
}else{
|
|
var cc=_234?dc.body1:dc.body2;
|
|
cc.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"+tr+"</tbody></table>");
|
|
}
|
|
}else{
|
|
opts.finder.getTr(_22c,_22d+1,"body",_235).before(tr);
|
|
}
|
|
};
|
|
_22f.call(this,true);
|
|
_22f.call(this,false);
|
|
_233.call(this,true);
|
|
_233.call(this,false);
|
|
data.total+=1;
|
|
data.rows.splice(_22d,0,row);
|
|
this.refreshRow.call(this,_22c,_22d);
|
|
},deleteRow:function(_238,_239){
|
|
var _23a=$.data(_238,"datagrid");
|
|
var opts=_23a.options;
|
|
var data=_23a.data;
|
|
function _23b(_23c){
|
|
var _23d=_23c?1:2;
|
|
for(var i=_239+1;i<data.rows.length;i++){
|
|
var tr=opts.finder.getTr(_238,i,"body",_23d);
|
|
tr.attr("datagrid-row-index",i-1);
|
|
tr.attr("id",_23a.rowIdPrefix+"-"+_23d+"-"+(i-1));
|
|
if(_23c&&opts.rownumbers){
|
|
var _23e=i;
|
|
if(opts.pagination){
|
|
_23e+=(opts.pageNumber-1)*opts.pageSize;
|
|
}
|
|
tr.find("div.datagrid-cell-rownumber").html(_23e);
|
|
}
|
|
if(opts.striped){
|
|
tr.removeClass("datagrid-row-alt").addClass((i-1)%2?"datagrid-row-alt":"");
|
|
}
|
|
}
|
|
};
|
|
opts.finder.getTr(_238,_239).remove();
|
|
_23b.call(this,true);
|
|
_23b.call(this,false);
|
|
data.total-=1;
|
|
data.rows.splice(_239,1);
|
|
},onBeforeRender:function(_23f,rows){
|
|
},onAfterRender:function(_240){
|
|
var _241=$.data(_240,"datagrid");
|
|
var opts=_241.options;
|
|
if(opts.showFooter){
|
|
var _242=$(_240).datagrid("getPanel").find("div.datagrid-footer");
|
|
_242.find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility","hidden");
|
|
}
|
|
if(opts.finder.getRows(_240).length==0){
|
|
this.renderEmptyRow(_240);
|
|
}
|
|
},renderEmptyRow:function(_243){
|
|
var cols=$.map($(_243).datagrid("getColumnFields"),function(_244){
|
|
return $(_243).datagrid("getColumnOption",_244);
|
|
});
|
|
$.map(cols,function(col){
|
|
col.formatter1=col.formatter;
|
|
col.styler1=col.styler;
|
|
col.formatter=col.styler=undefined;
|
|
});
|
|
var _245=$.data(_243,"datagrid").dc.body2;
|
|
_245.html(this.renderTable(_243,0,[{}],false));
|
|
_245.find("tbody *").css({height:1,borderColor:"transparent",background:"transparent"});
|
|
var tr=_245.find(".datagrid-row");
|
|
tr.removeClass("datagrid-row").removeAttr("datagrid-row-index");
|
|
tr.find(".datagrid-cell,.datagrid-cell-check").empty();
|
|
$.map(cols,function(col){
|
|
col.formatter=col.formatter1;
|
|
col.styler=col.styler1;
|
|
col.formatter1=col.styler1=undefined;
|
|
});
|
|
}};
|
|
$.fn.datagrid.defaults=$.extend({},$.fn.panel.defaults,{sharedStyleSheet:false,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,ctrlSelect:false,selectOnCheck:true,checkOnSelect:true,pagination:false,pagePosition:"bottom",pageNumber:1,pageSize:10,pageList:[10,20,30,40,50],queryParams:{},sortName:null,sortOrder:"asc",multiSort:false,remoteSort:true,showHeader:true,showFooter:false,scrollbarSize:18,rowEvents:{mouseover:_84(true),mouseout:_84(false),click:_8d,dblclick:_98,contextmenu:_9d},rowStyler:function(_246,_247){
|
|
},loader:function(_248,_249,_24a){
|
|
var opts=$(this).datagrid("options");
|
|
if(!opts.url){
|
|
return false;
|
|
}
|
|
$.ajax({type:opts.method,url:opts.url,data:_248,dataType:"json",success:function(data){
|
|
_249(data);
|
|
},error:function(){
|
|
_24a.apply(this,arguments);
|
|
}});
|
|
},loadFilter:function(data){
|
|
return data;
|
|
},editors:_1b7,finder:{getTr:function(_24b,_24c,type,_24d){
|
|
type=type||"body";
|
|
_24d=_24d||0;
|
|
var _24e=$.data(_24b,"datagrid");
|
|
var dc=_24e.dc;
|
|
var opts=_24e.options;
|
|
if(_24d==0){
|
|
var tr1=opts.finder.getTr(_24b,_24c,type,1);
|
|
var tr2=opts.finder.getTr(_24b,_24c,type,2);
|
|
return tr1.add(tr2);
|
|
}else{
|
|
if(type=="body"){
|
|
var tr=$("#"+_24e.rowIdPrefix+"-"+_24d+"-"+_24c);
|
|
if(!tr.length){
|
|
tr=(_24d==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index="+_24c+"]");
|
|
}
|
|
return tr;
|
|
}else{
|
|
if(type=="footer"){
|
|
return (_24d==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index="+_24c+"]");
|
|
}else{
|
|
if(type=="selected"){
|
|
return (_24d==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-selected");
|
|
}else{
|
|
if(type=="highlight"){
|
|
return (_24d==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-over");
|
|
}else{
|
|
if(type=="checked"){
|
|
return (_24d==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-checked");
|
|
}else{
|
|
if(type=="editing"){
|
|
return (_24d==1?dc.body1:dc.body2).find(">table>tbody>tr.datagrid-row-editing");
|
|
}else{
|
|
if(type=="last"){
|
|
return (_24d==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]:last");
|
|
}else{
|
|
if(type=="allbody"){
|
|
return (_24d==1?dc.body1:dc.body2).find(">table>tbody>tr[datagrid-row-index]");
|
|
}else{
|
|
if(type=="allfooter"){
|
|
return (_24d==1?dc.footer1:dc.footer2).find(">table>tbody>tr[datagrid-row-index]");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},getRow:function(_24f,p){
|
|
var _250=(typeof p=="object")?p.attr("datagrid-row-index"):p;
|
|
return $.data(_24f,"datagrid").data.rows[parseInt(_250)];
|
|
},getRows:function(_251){
|
|
return $(_251).datagrid("getRows");
|
|
}},view:_200,onBeforeLoad:function(_252){
|
|
},onLoadSuccess:function(){
|
|
},onLoadError:function(){
|
|
},onClickRow:function(_253,_254){
|
|
},onDblClickRow:function(_255,_256){
|
|
},onClickCell:function(_257,_258,_259){
|
|
},onDblClickCell:function(_25a,_25b,_25c){
|
|
},onBeforeSortColumn:function(sort,_25d){
|
|
},onSortColumn:function(sort,_25e){
|
|
},onResizeColumn:function(_25f,_260){
|
|
},onBeforeSelect:function(_261,_262){
|
|
},onSelect:function(_263,_264){
|
|
},onBeforeUnselect:function(_265,_266){
|
|
},onUnselect:function(_267,_268){
|
|
},onSelectAll:function(rows){
|
|
},onUnselectAll:function(rows){
|
|
},onBeforeCheck:function(_269,_26a){
|
|
},onCheck:function(_26b,_26c){
|
|
},onBeforeUncheck:function(_26d,_26e){
|
|
},onUncheck:function(_26f,_270){
|
|
},onCheckAll:function(rows){
|
|
},onUncheckAll:function(rows){
|
|
},onBeforeEdit:function(_271,_272){
|
|
},onBeginEdit:function(_273,_274){
|
|
},onEndEdit:function(_275,_276,_277){
|
|
},onAfterEdit:function(_278,_279,_27a){
|
|
},onCancelEdit:function(_27b,_27c){
|
|
},onHeaderContextMenu:function(e,_27d){
|
|
},onRowContextMenu:function(e,_27e,_27f){
|
|
}});
|
|
})(jQuery);
|
|
|