BBSWeb/Scripts/jqGrid/jquery.jqGrid.min.js
(开头部分) 220KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
var xmlJsonClass={xml2json:function(a,c){if(a.nodeType===9)a=a.documentElement;a=this.toJson(this.toObj(this.removeWhite(a)),a.nodeName,"\t");return"{\n"+c+(c?a.replace(/\t/g,c):a.replace(/\t|\n/g,""))+"\n}"},json2xml:function(a,c){var e=function(g,h,j){var d="",k,l;if(g instanceof Array)if(g.length===0)d+=j+"<"+h+">__EMPTY_ARRAY_</"+h+">\n";else{k=0;for(l=g.length;k<l;k+=1){var o=j+e(g[k],h,j+"\t")+"\n";d+=o}}else if(typeof g==="object"){k=false;d+=j+"<"+h;for(l in g)if(g.hasOwnProperty(l))if(l.charAt(0)===
"@")d+=" "+l.substr(1)+'="'+g[l].toString()+'"';else k=true;d+=k?">":"/>";if(k){for(l in g)if(g.hasOwnProperty(l))if(l==="#text")d+=g[l];else if(l==="#cdata")d+="<![CDATA["+g[l]+"]]\>";else if(l.charAt(0)!=="@")d+=e(g[l],l,j+"\t");d+=(d.charAt(d.length-1)==="\n"?j:"")+"</"+h+">"}}else d+=typeof g==="function"?j+"<"+h+"><![CDATA["+g+"]]\></"+h+">":g.toString()==='""'||g.toString().length===0?j+"<"+h+">__EMPTY_STRING_</"+h+">":j+"<"+h+">"+g.toString()+"</"+h+">";return d},b="",f;for(f in a)if(a.hasOwnProperty(f))b+=
e(a[f],f,"");return c?b.replace(/\t/g,c):b.replace(/\t|\n/g,"")},toObj:function(a){var c={},e=/function/i;if(a.nodeType===1){if(a.attributes.length){var b;for(b=0;b<a.attributes.length;b+=1)c["@"+a.attributes[b].nodeName]=(a.attributes[b].nodeValue||"").toString()}if(a.firstChild){var f=b=0,g=false,h;for(h=a.firstChild;h;h=h.nextSibling)if(h.nodeType===1)g=true;else if(h.nodeType===3&&h.nodeValue.match(/[^ \f\n\r\t\v]/))b+=1;else if(h.nodeType===4)f+=1;if(g)if(b<2&&f<2){this.removeWhite(a);for(h=
a.firstChild;h;h=h.nextSibling)if(h.nodeType===3)c["#text"]=this.escape(h.nodeValue);else if(h.nodeType===4)if(e.test(h.nodeValue))c[h.nodeName]=[c[h.nodeName],h.nodeValue];else c["#cdata"]=this.escape(h.nodeValue);else if(c[h.nodeName])if(c[h.nodeName]instanceof Array)c[h.nodeName][c[h.nodeName].length]=this.toObj(h);else c[h.nodeName]=[c[h.nodeName],this.toObj(h)];else c[h.nodeName]=this.toObj(h)}else if(a.attributes.length)c["#text"]=this.escape(this.innerXml(a));else c=this.escape(this.innerXml(a));
else if(b)if(a.attributes.length)c["#text"]=this.escape(this.innerXml(a));else{c=this.escape(this.innerXml(a));if(c==="__EMPTY_ARRAY_")c="[]";else if(c==="__EMPTY_STRING_")c=""}else if(f)if(f>1)c=this.escape(this.innerXml(a));else for(h=a.firstChild;h;h=h.nextSibling)if(e.test(a.firstChild.nodeValue)){c=a.firstChild.nodeValue;break}else c["#cdata"]=this.escape(h.nodeValue)}if(!a.attributes.length&&!a.firstChild)c=null}else if(a.nodeType===9)c=this.toObj(a.documentElement);else alert("unhandled node type: "+
a.nodeType);return c},toJson:function(a,c,e){var b=c?'"'+c+'"':"";if(a==="[]")b+=c?":[]":"[]";else if(a instanceof Array){var f,g,h=[];g=0;for(f=a.length;g<f;g+=1)h[g]=this.toJson(a[g],"",e+"\t");b+=(c?":[":"[")+(h.length>1?"\n"+e+"\t"+h.join(",\n"+e+"\t")+"\n"+e:h.join(""))+"]"}else if(a===null)b+=(c&&":")+"null";else if(typeof a==="object"){f=[];for(g in a)if(a.hasOwnProperty(g))f[f.length]=this.toJson(a[g],g,e+"\t");b+=(c?":{":"{")+(f.length>1?"\n"+e+"\t"+f.join(",\n"+e+"\t")+"\n"+e:f.join(""))+
"}"}else if(typeof a==="string"){e=/function/i;f=a.toString();b+=/(^-?\d+\.?\d*$)/.test(f)||e.test(f)||f==="false"||f==="true"?(c&&":")+f:(c&&":")+'"'+a+'"'}else b+=(c&&":")+a.toString();return b},innerXml:function(a){var c="";if("innerHTML"in a)c=a.innerHTML;else{var e=function(b){var f="",g;if(b.nodeType===1){f+="<"+b.nodeName;for(g=0;g<b.attributes.length;g+=1)f+=" "+b.attributes[g].nodeName+'="'+(b.attributes[g].nodeValue||"").toString()+'"';if(b.firstChild){f+=">";for(g=b.firstChild;g;g=g.nextSibling)f+=
e(g);f+="</"+b.nodeName+">"}else f+="/>"}else if(b.nodeType===3)f+=b.nodeValue;else if(b.nodeType===4)f+="<![CDATA["+b.nodeValue+"]]\>";return f};for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}return c},escape:function(a){return a.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(a){a.normalize();var c;for(c=a.firstChild;c;)if(c.nodeType===3)if(c.nodeValue.match(/[^ \f\n\r\t\v]/))c=c.nextSibling;else{var e=c.nextSibling;a.removeChild(c);
c=e}else{c.nodeType===1&&this.removeWhite(c);c=c.nextSibling}return a}};
(function(a){a.jgrid=a.jgrid||{};a.extend(a.jgrid,{htmlDecode:function(c){if(c==" "||c==" "||c.length==1&&c.charCodeAt(0)==160)return"";return!c?c:String(c).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,'"')},htmlEncode:function(c){return!c?c:String(c).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/\"/g,""")},format:function(c){var e=a.makeArray(arguments).slice(1);if(c===undefined)c="";return c.replace(/\{(\d+)\}/g,function(b,
f){return e[f]})},getCellIndex:function(c){c=a(c);if(c.is("tr"))return-1;c=(!c.is("td")&&!c.is("th")?c.closest("td,th"):c)[0];if(a.browser.msie)return a.inArray(c,c.parentNode.cells);return c.cellIndex},stripHtml:function(c){c+="";var e=/<("[^"]*"|'[^']*'|[^'">])*>/gi;if(c)return(c=c.replace(e,""))&&c!==" "&&c!==" "?c.replace(/\"/g,"'"):"";else return c},stringToDoc:function(c){var e;if(typeof c!=="string")return c;try{e=(new DOMParser).parseFromString(c,"text/xml")}catch(b){e=new ActiveXObject("Microsoft.XMLDOM");
e.async=false;e.loadXML(c)}return e&&e.documentElement&&e.documentElement.tagName!="parsererror"?e:null},parse:function(c){c=c;if(c.substr(0,9)=="while(1);")c=c.substr(9);if(c.substr(0,2)=="/*")c=c.substr(2,c.length-4);c||(c="{}");return a.jgrid.useJSON===true&&typeof JSON==="object"&&typeof JSON.parse==="function"?JSON.parse(c):eval("("+c+")")},parseDate:function(c,e){var b={m:1,d:1,y:1970,h:0,i:0,s:0},f,g,h;if(e&&e!==null&&e!==undefined){e=a.trim(e);e=e.split(/[\\\/:_;.\t\T\s-]/);c=c.split(/[\\\/:_;.\t\T\s-]/);
var j=a.jgrid.formatter.date.monthNames,d=a.jgrid.formatter.date.AmPm,k=function(l,o){if(l===0){if(o==12)o=0}else if(o!=12)o+=12;return o};f=0;for(g=c.length;f<g;f++){if(c[f]=="M"){h=a.inArray(e[f],j);if(h!==-1&&h<12)e[f]=h+1}if(c[f]=="F"){h=a.inArray(e[f],j);if(h!==-1&&h>11)e[f]=h+1-12}if(c[f]=="a"){h=a.inArray(e[f],d);if(h!==-1&&h<2&&e[f]==d[h]){e[f]=h;b.h=k(e[f],b.h)}}if(c[f]=="A"){h=a.inArray(e[f],d);if(h!==-1&&h>1&&e[f]==d[h]){e[f]=h-2;b.h=k(e[f],b.h)}}if(e[f]!==undefined)b[c[f].toLowerCase()]=
parseInt(e[f],10)}b.m=parseInt(b.m,10)-1;c=b.y;if(c>=70&&c<=99)b.y=1900+b.y;else if(c>=0&&c<=69)b.y=2E3+b.y}return new Date(b.y,b.m,b.d,b.h,b.i,b.s,0)},jqID:function(c){c+="";return c.replace(/([\.\:\[\]])/g,"\\$1")},getAccessor:function(c,e){var b,f,g,h;if(typeof e==="function")return e(c);b=c[e];if(b===undefined)try{if(typeof e==="string")g=e.split(".");if(h=g.length)for(b=c;b&&h--;){f=g.shift();b=b[f]}}catch(j){}return b},ajaxOptions:{},from:function(c){return new (function(e,b){if(typeof e=="string")e=
a.data(e);var f=this,g=e,h=true,j=false,d=b,k=/[\$,%]/g,l=null,o=null,n=false,r="",q=[],t=true;if(typeof e=="object"&&e.push){if(e.length>0)t=typeof e[0]!="object"?false:true}else throw"data provides is not an array";this._hasData=function(){return g===null?false:g.length===0?false:true};this._getStr=function(m){var p=[];j&&p.push("jQuery.trim(");p.push("String("+m+")");j&&p.push(")");h||p.push(".toLowerCase()");return p.join("")};this._strComp=function(m){return typeof m=="string"?".toString()":
""};this._group=function(m,p){return{field:m.toString(),unique:p,items:[]}};this._toStr=function(m){if(j)m=a.trim(m);h||(m=m.toLowerCase());return m=m.toString().replace(new RegExp('\\"',"g"),'\\"')};this._funcLoop=function(m){var p=[];a.each(g,function(v,y){p.push(m(y))});return p};this._append=function(m){if(d===null)d="";else d+=r===""?" && ":r;if(n)d+="!";d+="("+m+")";n=false;r=""};this._setCommand=function(m,p){l=m;o=p};this._resetNegate=function(){n=false};this._repeatCommand=function(m,p){if(l===
null)return f;if(m!=null&&p!=null)return l(m,p);if(o===null)return l(m);if(!t)return l(m);return l(o,m)};this._equals=function(m,p){return f._compare(m,p,1)===0};this._compare=function(m,p,v){if(v===undefined)v=1;if(m===undefined)m=null;if(p===undefined)p=null;if(m===null&&p===null)return 0;if(m===null&&p!==null)return 1;if(m!==null&&p===null)return-1;if(!h&&typeof m!=="number"&&typeof p!=="number"){m=String(m).toLowerCase();p=String(p).toLowerCase()}if(m<p)return-v;if(m>p)return v;return 0};this._performSort=
function(){if(q.length!==0)g=f._doSort(g,0)};this._doSort=function(m,p){var v=q[p].by,y=q[p].dir,z=q[p].type,B=q[p].datefmt;if(p==q.length-1)return f._getOrder(m,v,y,z,B);p++;m=f._getGroup(m,v,y,z,B);v=[];for(y=0;y<m.length;y++){z=f._doSort(m[y].items,p);for(B=0;B<z.length;B++)v.push(z[B])}return v};this._getOrder=function(m,p,v,y,z){var B=[],H=[],A=v=="a"?1:-1,u,F;if(y===undefined)y="text";F=y=="float"||y=="number"||y=="currency"||y=="numeric"?function(Q){Q=parseFloat(String(Q).replace(k,""));return isNaN(Q)?
0:Q}:y=="int"||y=="integer"?function(Q){return Q?parseFloat(String(Q).replace(k,"")):0}:y=="date"||y=="datetime"?function(Q){return a.jgrid.parseDate(z,Q).getTime()}:a.isFunction(y)?y:function(Q){Q||(Q="");return a.trim(String(Q).toUpperCase())};a.each(m,function(Q,U){u=p!==""?a.jgrid.getAccessor(U,p):U;if(u===undefined)u="";u=F(u,U);H.push({vSort:u,index:Q})});H.sort(function(Q,U){Q=Q.vSort;U=U.vSort;return f._compare(Q,U,A)});y=0;for(var I=m.length;y<I;){v=H[y].index;B.push(m[v]);y++}return B};
this._getGroup=function(m,p,v,y,z){var B=[],H=null,A=null,u;a.each(f._getOrder(m,p,v,y,z),function(F,I){u=a.jgrid.getAccessor(I,p);if(u===undefined)u="";if(!f._equals(A,u)){A=u;H!=null&&B.push(H);H=f._group(p,u)}H.items.push(I)});H!=null&&B.push(H);return B};this.ignoreCase=function(){h=false;return f};this.useCase=function(){h=true;return f};this.trim=function(){j=true;return f};this.noTrim=function(){j=false;return f};this.combine=function(m){var p=a.from(g);h||p.ignoreCase();j&&p.trim();m=m(p).showQuery();
f._append(m);return f};this.execute=function(){var m=d,p=[];if(m===null)return f;a.each(g,function(){eval(m)&&p.push(this)});g=p;return f};this.data=function(){return g};this.select=function(m){f._performSort();if(!f._hasData())return[];f.execute();if(a.isFunction(m)){var p=[];a.each(g,function(v,y){p.push(m(y))});return p}return g};this.hasMatch=function(){if(!f._hasData())return false;f.execute();return g.length>0};this.showQuery=function(m){var p=d;if(p===null)p="no query found";if(a.isFunction(m)){m(p);
return f}return p};this.andNot=function(m,p,v){n=!n;return f.and(m,p,v)};this.orNot=function(m,p,v){n=!n;return f.or(m,p,v)};this.not=function(m,p,v){return f.andNot(m,p,v)};this.and=function(m,p,v){r=" && ";if(m===undefined)return f;return f._repeatCommand(m,p,v)};this.or=function(m,p,v){r=" || ";if(m===undefined)return f;return f._repeatCommand(m,p,v)};this.isNot=function(m){n=!n;return f.is(m)};this.is=function(m){f._append("this."+m);f._resetNegate();return f};this._compareValues=function(m,p,
v,y,z){var B;B=t?"this."+p:"this";if(v===undefined)v=null;v=v===null?p:v;switch(z.stype===undefined?"text":z.stype){case "int":case "integer":v=isNaN(Number(v))?"0":v;B="parseInt("+B+",10)";v="parseInt("+v+",10)";break;case "float":case "number":case "numeric":v=String(v).replace(k,"");v=isNaN(Number(v))?"0":v;B="parseFloat("+B+")";v="parseFloat("+v+")";break;case "date":case "datetime":v=String(a.jgrid.parseDate(z.newfmt||"Y-m-d",v).getTime());B='jQuery.jgrid.parseDate("'+z.srcfmt+'",'+B+").getTime()";
break;default:B=f._getStr(B);v=f._getStr('"'+f._toStr(v)+'"')}f._append(B+" "+y+" "+v);f._setCommand(m,p);f._resetNegate();return f};this.equals=function(m,p,v){return f._compareValues(f.equals,m,p,"==",v)};this.greater=function(m,p,v){return f._compareValues(f.greater,m,p,">",v)};this.less=function(m,p,v){return f._compareValues(f.less,m,p,"<",v)};this.greaterOrEquals=function(m,p,v){return f._compareValues(f.greaterOrEquals,m,p,">=",v)};this.lessOrEquals=function(m,p,v){return f._compareValues(f.lessOrEquals,
m,p,"<=",v)};this.startsWith=function(m,p){var v=p===undefined||p===null?m:p;v=j?a.trim(v.toString()).length:v.toString().length;if(t)f._append(f._getStr("this."+m)+".substr(0,"+v+") == "+f._getStr('"'+f._toStr(p)+'"'));else{v=j?a.trim(p.toString()).length:p.toString().length;f._append(f._getStr("this")+".substr(0,"+v+") == "+f._getStr('"'+f._toStr(m)+'"'))}f._setCommand(f.startsWith,m);f._resetNegate();return f};this.endsWith=function(m,p){var v=p===undefined||p===null?m:p;v=j?a.trim(v.toString()).length:
v.toString().length;t?f._append(f._getStr("this."+m)+".substr("+f._getStr("this."+m)+".length-"+v+","+v+') == "'+f._toStr(p)+'"'):f._append(f._getStr("this")+".substr("+f._getStr("this")+'.length-"'+f._toStr(m)+'".length,"'+f._toStr(m)+'".length) == "'+f._toStr(m)+'"');f._setCommand(f.endsWith,m);f._resetNegate();return f};this.contains=function(m,p){t?f._append(f._getStr("this."+m)+'.indexOf("'+f._toStr(p)+'",0) > -1'):f._append(f._getStr("this")+'.indexOf("'+f._toStr(m)+'",0) > -1');f._setCommand(f.contains,
m);f._resetNegate();return f};this.groupBy=function(m,p,v,y){if(!f._hasData())return null;return f._getGroup(g,m,p,v,y)};this.orderBy=function(m,p,v,y){p=p===undefined||p===null?"a":a.trim(p.toString().toLowerCase());if(v===null||v===undefined)v="text";if(y===null||y===undefined)y="Y-m-d";if(p=="desc"||p=="descending")p="d";if(p=="asc"||p=="ascending")p="a";q.push({by:m,dir:p,type:v,datefmt:y});return f};return f})(c,null)},extend:function(c){a.extend(a.fn.jqGrid,c);this.no_legacy_api||a.fn.extend(c)}});
a.fn.jqGrid=function(c){if(typeof c=="string"){var e=a.jgrid.getAccessor(a.fn.jqGrid,c);if(!e)throw"jqGrid - No such method: "+c;var b=a.makeArray(arguments).slice(1);return e.apply(this,b)}return this.each(function(){if(!this.grid){var f=a.extend(true,{url:"",height:150,page:1,rowNum:20,rowTotal:null,records:0,pager:"",pgbuttons:true,pginput:true,colModel:[],rowList:[],colNames:[],sortorder:"asc",sortname:"",datatype:"xml",mtype:"GET",altRows:false,selarrrow:[],savedRow:[],shrinkToFit:true,xmlReader:{},
jsonReader:{},subGrid:false,subGridModel:[],reccount:0,lastpage:0,lastsort:0,selrow:null,beforeSelectRow:null,onSelectRow:null,onSortCol:null,ondblClickRow:null,onRightClickRow:null,onPaging:null,onSelectAll:null,loadComplete:null,gridComplete:null,loadError:null,loadBeforeSend:null,afterInsertRow:null,beforeRequest:null,onHeaderClick:null,viewrecords:false,loadonce:false,multiselect:false,multikey:false,editurl:null,search:false,caption:"",hidegrid:true,hiddengrid:false,postData:{},userData:{},treeGrid:false,
treeGridModel:"nested",treeReader:{},treeANode:-1,ExpandColumn:null,tree_root_level:0,prmNames:{page:"page",rows:"rows",sort:"sidx",order:"sord",search:"_search",nd:"nd",id:"id",oper:"oper",editoper:"edit",addoper:"add",deloper:"del",subgridid:"id",npage:null,totalrows:"totalrows"},forceFit:false,gridstate:"visible",cellEdit:false,cellsubmit:"remote",nv:0,loadui:"enable",toolbar:[false,""],scroll:false,multiboxonly:false,deselectAfterSort:true,scrollrows:false,autowidth:false,scrollOffset:18,cellLayout:5,
subGridWidth:20,multiselectWidth:20,gridview:false,rownumWidth:25,rownumbers:false,pagerpos:"center",recordpos:"right",footerrow:false,userDataOnFooter:false,hoverrows:true,altclass:"ui-priority-secondary",viewsortcols:[false,"vertical",true],resizeclass:"",autoencode:false,remapColumns:[],ajaxGridOptions:{},direction:"ltr",toppager:false,headertitles:false,scrollTimeout:40,data:[],_index:{},grouping:false,groupingView:{groupField:[],groupOrder:[],groupText:[],groupColumnShow:[],groupSummary:[],showSummaryOnHide:false,
sortitems:[],sortnames:[],groupDataSorted:false,summary:[],summaryval:[],plusicon:"ui-icon-circlesmall-plus",minusicon:"ui-icon-circlesmall-minus"},ignoreCase:false},a.jgrid.defaults,c||{}),g={headers:[],cols:[],footers:[],dragStart:function(s,w,x){this.resizing={idx:s,startX:w.clientX,sOL:x[0]};this.hDiv.style.cursor="col-resize";this.curGbox=a("#rs_m"+f.id,"#gbox_"+f.id);this.curGbox.css({display:"block",left:x[0],top:x[1],height:x[2]});a.isFunction(f.resizeStart)&&f.resizeStart.call(this,w,s);
document.onselectstart=function(){return false}},dragMove:function(s){if(this.resizing){var w=s.clientX-this.resizing.startX;s=this.headers[this.resizing.idx];var x=f.direction==="ltr"?s.width+w:s.width-w,E;if(x>33){this.curGbox.css({left:this.resizing.sOL+w});if(f.forceFit===true){E=this.headers[this.resizing.idx+f.nv];w=f.direction==="ltr"?E.width-w:E.width+w;if(w>33){s.newWidth=x;E.newWidth=w}}else{this.newWidth=f.direction==="ltr"?f.tblwidth+w:f.tblwidth-w;s.newWidth=x}}}},dragEnd:function(){this.hDiv.style.cursor=
"default";if(this.resizing){var s=this.resizing.idx,w=this.headers[s].newWidth||this.headers[s].width;w=parseInt(w,10);this.resizing=false;a("#rs_m"+f.id).css("display","none");f.colModel[s].width=w;this.headers[s].width=w;this.headers[s].el.style.width=w+"px";this.cols[s].style.width=w+"px";if(this.footers.length>0)this.footers[s].style.width=w+"px";if(f.forceFit===true){w=this.headers[s+f.nv].newWidth||this.headers[s+f.nv].width;this.headers[s+f.nv].width=w;this.headers[s+f.nv].el.style.width=w+
"px";this.cols[s+f.nv].style.width=w+"px";if(this.footers.length>0)this.footers[s+f.nv].style.width=w+"px";f.colModel[s+f.nv].width=w}else{f.tblwidth=this.newWidth||f.tblwidth;a("table:first",this.bDiv).css("width",f.tblwidth+"px");a("table:first",this.hDiv).css("width",f.tblwidth+"px");this.hDiv.scrollLeft=this.bDiv.scrollLeft;if(f.footerrow){a("table:first",this.sDiv).css("width",f.tblwidth+"px");this.sDiv.scrollLeft=this.bDiv.scrollLeft}}a.isFunction(f.resizeStop)&&f.resizeStop.call(this,w,s)}this.curGbox=
null;document.onselectstart=function(){return true}},populateVisible:function(){g.timer&&clearTimeout(g.timer);g.timer=null;var s=a(g.bDiv).height();if(s){var w=a("table:first",g.bDiv),x=a("> tbody > tr:gt(0):visible:first",w).outerHeight()||g.prevRowHeight;if(x){g.prevRowHeight=x;var E=f.rowNum,D=g.scrollTop=g.bDiv.scrollTop,O=Math.round(w.position().top)-D,K=O+w.height();x=x*E;var T,W,G;if(K<s&&O<=0&&(f.lastpage===undefined||parseInt((K+D+x-1)/x,10)<=f.lastpage)){W=parseInt((s-K+x-1)/x,10);if(K>=
0||W<2||f.scroll===true){T=Math.round((K+D)/x)+1;O=-1}else O=1}if(O>0){T=parseInt(D/x,10)+1;W=parseInt((D+s)/x,10)+2-T;G=true}if(W)if(!(f.lastpage&&T>f.lastpage||f.lastpage==1))if(g.hDiv.loading)g.timer=setTimeout(g.populateVisible,f.scrollTimeout);else{f.page=T;if(G){g.selectionPreserver(w[0]);g.emptyRows(g.bDiv,false)}g.populate(W)}}}},scrollGrid:function(){if(f.scroll){var s=g.bDiv.scrollTop;if(g.scrollTop===undefined)g.scrollTop=0;if(s!=g.scrollTop){g.scrollTop=s;g.timer&&clearTimeout(g.timer);
g.timer=setTimeout(g.populateVisible,f.scrollTimeout)}}g.hDiv.scrollLeft=g.bDiv.scrollLeft;if(f.footerrow)g.sDiv.scrollLeft=g.bDiv.scrollLeft},selectionPreserver:function(s){var w=s.p,x=w.selrow,E=w.selarrrow?a.makeArray(w.selarrrow):null,D=s.grid.bDiv.scrollLeft,O=w.gridComplete;w.gridComplete=function(){w.selrow=null;w.selarrrow=[];if(w.multiselect&&E&&E.length>0)for(var K=0;K<E.length;K++)E[K]!=x&&a(s).jqGrid("setSelection",E[K],false);x&&a(s).jqGrid("setSelection",x,false);s.grid.bDiv.scrollLeft=
D;w.gridComplete=O;w.gridComplete&&O()}}};if(this.tagName!="TABLE")alert("Element is not a table");else{a(this).empty();this.p=f;var h,j,d;if(this.p.colNames.length===0)for(h=0;h<this.p.colModel.length;h++)this.p.colNames[h]=this.p.colModel[h].label||this.p.colModel[h].name;if(this.p.colNames.length!==this.p.colModel.length)alert(a.jgrid.errors.model);else{var k=a("<div class='ui-jqgrid-view'></div>"),l,o=a.browser.msie?true:false,n=a.browser.safari?true:false;d=this;d.p.direction=a.trim(d.p.direction.toLowerCase());
if(a.inArray(d.p.direction,["ltr","rtl"])==-1)d.p.direction="ltr";j=d.p.direction;a(k).insertBefore(this);a(this).appendTo(k).removeClass("scroll");var r=a("<div class='ui-jqgrid ui-widget ui-widget-content ui-corner-all'></div>");a(r).insertBefore(k).attr({id:"gbox_"+this.id,dir:j});a(k).appendTo(r).attr("id","gview_"+this.id);l=o&&a.browser.version<=6?'<iframe style="display:block;position:absolute;z-index:-1;filter:Alpha(Opacity=\'0\');" src="javascript:false;"></iframe>':"";a("<div class='ui-widget-overlay jqgrid-overlay' id='lui_"+
this.id+"'></div>").append(l).insertBefore(k);a("<div class='loading ui-state-default ui-state-active' id='load_"+this.id+"'>"+this.p.loadtext+"</div>").insertBefore(k);a(this).attr({cellspacing:"0",cellpadding:"0",border:"0",role:"grid","aria-multiselectable":!!this.p.multiselect,"aria-labelledby":"gbox_"+this.id});var q=function(s,w){s=parseInt(s,10);return isNaN(s)?w?w:0:s},t=function(s,w,x){var E=d.p.colModel[s],D=E.align,O='style="',K=E.classes,T=E.name;if(D)O+="text-align:"+D+";";if(E.hidden===
true)O+="display:none;";if(w===0)O+="width: "+g.headers[s].width+"px;";O+='"'+(K!==undefined?' class="'+K+'"':"")+(E.title&&x?' title="'+a.jgrid.stripHtml(x)+'"':"");O+=' aria-describedby="'+d.p.id+"_"+T+'"';return O},m=function(s){return s===undefined||s===null||s===""?" ":d.p.autoencode?a.jgrid.htmlEncode(s):s+""},p=function(s,w,x,E,D){x=d.p.colModel[x];if(typeof x.formatter!=="undefined"){s={rowId:s,colModel:x,gid:d.p.id};w=a.isFunction(x.formatter)?x.formatter.call(d,w,s,E,D):a.fmatter?a.fn.fmatter(x.formatter,
w,s,E,D):m(w)}else w=m(w);return w},v=function(s,w,x,E,D){s=p(s,w,x,D,"add");return'<td role="gridcell" '+t(x,E,s)+">"+s+"</td>"},y=function(s,w,x){s='<input role="checkbox" type="checkbox" id="jqg_'+d.p.id+"_"+s+'" class="cbox" name="jqg_'+d.p.id+"_"+s+'"/>';return'<td role="gridcell" '+t(w,x,"")+">"+s+"</td>"},z=function(s,w,x,E){x=(parseInt(x,10)-1)*parseInt(E,10)+1+w;return'<td role="gridcell" class="ui-state-default jqgrid-rownum" '+t(s,w,"")+">"+x+"</td>"},B=function(s){var w,x=[],E=0,D;for(D=
0;D<d.p.colModel.length;D++){w=d.p.colModel[D];if(w.name!=="cb"&&w.name!=="subgrid"&&w.name!=="rn"){x[E]=s=="local"?w.name:s=="xml"?w.xmlmap||w.name:w.jsonmap||w.name;E++}}return x},H=function(s){var w=d.p.remapColumns;if(!w||!w.length)w=a.map(d.p.colModel,function(x,E){return E});if(s)w=a.map(w,function(x){return x<s?null:x-s});return w},A=function(s,w){if(d.p.deepempty)a("#"+d.p.id+" tbody:first tr:gt(0)").remove();else{var x=a("#"+d.p.id+" tbody:first tr:first")[0];a("#"+d.p.id+" tbody:first").empty().append(x)}if(w&&
d.p.scroll){a(">div:first",s).css({height:"22px"}).children("div:first").css({height:0,display:"none"});s.scrollTop=0}},u=function(){var s=d.p.data.length,w,x,E;w=d.p.rownumbers===true?1:0;x=d.p.multiselect===true?1:0;E=d.p.subGrid===true?1:0;w=d.p.keyIndex===false||d.p.loadonce===true?d.p.localReader.id:d.p.colModel[d.p.keyIndex+x+E+w].name;for(x=0;x<s;x++){E=a.jgrid.getAccessor(d.p.data[x],w);d.p._index[E]=x}},F=function(s,w,x,E,D){var O=new Date,K=d.p.datatype!="local"&&d.p.loadonce||d.p.datatype==
"xmlstring",T,W=d.p.datatype=="local"?"local":"xml";if(K){d.p.data=[];d.p._index={};d.p.localReader.id=T="_id_"}d.p.reccount=0;if(a.isXMLDoc(s)){if(d.p.treeANode===-1&&!d.p.scroll){A(w,false);x=1}else x=x>1?x:1;var G,J=0,P,Z,ea=0,$=0,ga=0,R,na=[],sa,ma={},ja,ha,ta=[],Fa=d.p.altRows===true?" "+d.p.altclass:"";d.p.xmlReader.repeatitems||(na=B(W));R=d.p.keyIndex===false?d.p.xmlReader.id:d.p.keyIndex;if(na.length>0&&!isNaN(R)){if(d.p.remapColumns&&d.p.remapColumns.length)R=a.inArray(R,d.p.remapColumns);
R=na[R]}W=(R+"").indexOf("[")===-1?na.length?function(za,va){return a(R,za).text()||va}:function(za,va){return a(d.p.xmlReader.cell,za).eq(R).text()||va}:function(za,va){return za.getAttribute(R.replace(/[\[\]]/g,""))||va};d.p.userData={};a(d.p.xmlReader.page,s).each(function(){d.p.page=this.textContent||this.text||0});a(d.p.xmlReader.total,s).each(function(){d.p.lastpage=this.textContent||this.text;if(d.p.lastpage===undefined)d.p.lastpage=1});a(d.p.xmlReader.records,s).each(function(){d.p.records=
this.textContent||this.text||0});a(d.p.xmlReader.userdata,s).each(function(){d.p.userData[this.getAttribute("name")]=this.textContent||this.text});(s=a(d.p.xmlReader.root+" "+d.p.xmlReader.row,s))||(s=[]);var Ba=s.length,wa=0;if(s&&Ba){var Da=parseInt(d.p.rowNum,10),Ha=d.p.scroll?(parseInt(d.p.page,10)-1)*Da+1:1;if(D)Da*=D+1;D=a.isFunction(d.p.afterInsertRow);var Ea={},Ia="";if(d.p.grouping&&d.p.groupingView.groupCollapse===true)Ia=' style="display:none;"';for(;wa<Ba;){ja=s[wa];ha=W(ja,Ha+wa);G=x===
0?0:x+1;G=(G+wa)%2==1?Fa:"";ta.push("<tr"+Ia+' id="'+ha+'" role="row" class ="ui-widget-content jqgrow ui-row-'+d.p.direction+""+G+'">');if(d.p.rownumbers===true){ta.push(z(0,wa,d.p.page,d.p.rowNum));ga=1}if(d.p.multiselect===true){ta.push(y(ha,ga,wa));ea=1}if(d.p.subGrid===true){ta.push(a(d).jqGrid("addSubGridCell",ea+ga,wa+x));$=1}if(d.p.xmlReader.repeatitems){sa||(sa=H(ea+$+ga));var Ka=a(d.p.xmlReader.cell,ja);a.each(sa,function(za){var va=Ka[this];if(!va)return false;P=va.textContent||va.text;
ma[d.p.colModel[za+ea+$+ga].name]=P;ta.push(v(ha,P,za+ea+$+ga,wa+x,ja))})}else for(G=0;G<na.length;G++){P=a(na[G],ja).text();ma[d.p.colModel[G+ea+$+ga].name]=P;ta.push(v(ha,P,G+ea+$+ga,wa+x,ja))}ta.push("</tr>");if(d.p.grouping){G=d.p.groupingView.groupField.length;Z=[];for(var Ja=0;Ja<G;Ja++)Z.push(ma[d.p.groupingView.groupField[Ja]]);Ea=a(d).jqGrid("groupingPrepare",ta,Z,Ea,ma);ta=[]}if(K){ma[T]=ha;d.p.data.push(ma)}if(d.p.gridview===false){if(d.p.treeGrid===true){G=d.p.treeANode>-1?d.p.treeANode:
0;Z=a(ta.join(""))[0];a(d.rows[wa+G]).after(Z);try{a(d).jqGrid("setTreeNode",ma,Z)}catch(Ma){}}else a("tbody:first",w).append(ta.join(""));if(d.p.subGrid===true)try{a(d).jqGrid("addSubGrid",d.rows[d.rows.length-1],ea+ga)}catch(Na){}D&&d.p.afterInsertRow.call(d,ha,ma,ja);ta=[]}ma={};J++;wa++;if(J==Da)break}}if(d.p.gridview===true)if(d.p.grouping){a(d).jqGrid("groupingRender",Ea,d.p.colModel.length);Ea=null}else a("tbody:first",w).append(ta.join(""));d.p.totaltime=new Date-O;if(J>0)if(d.p.records===
0)d.p.records=Ba;ta=null;if(!d.p.treeGrid&&!d.p.scroll)d.grid.bDiv.scrollTop=0;d.p.reccount=J;d.p.treeANode=-1;d.p.userDataOnFooter&&a(d).jqGrid("footerData","set",d.p.userData,true);if(K){d.p.records=Ba;d.p.lastpage=Math.ceil(Ba/Da)}E||d.updatepager(false,true);if(K){for(;J<Ba;){ja=s[J];ha=W(ja,J);if(d.p.xmlReader.repeatitems){sa||(sa=H(ea+$+ga));var La=a(d.p.xmlReader.cell,ja);a.each(sa,function(za){var va=La[this];if(!va)return false;P=va.textContent||va.text;ma[d.p.colModel[za+ea+$+ga].name]=
P})}else for(G=0;G<na.length;G++){P=a(na[G],ja).text();ma[d.p.colModel[G+ea+$+ga].name]=P}ma[T]=ha;d.p.data.push(ma);ma={};J++}u()}}},I=function(s,w,x,E,D){var O=new Date;if(s){if(d.p.treeANode===-1&&!d.p.scroll){A(w,false);x=1}else x=x>1?x:1;var K,T,W=d.p.datatype!="local"&&d.p.loadonce||d.p.datatype=="jsonstring";if(W){d.p.data=[];d.p._index={};K=d.p.localReader.id="_id_"}d.p.reccount=0;if(d.p.datatype=="local"){w=d.p.localReader;T="local"}else{w=d.p.jsonReader;T="json"}var G=0,J,P,Z,ea=[],$,ga=
0,R=0,na=0,sa,ma,ja={},ha;Z=[];var ta=d.p.altRows===true?" "+d.p.altclass:"";d.p.page=a.jgrid.getAccessor(s,w.page)||0;sa=a.jgrid.getAccessor(s,w.total);d.p.lastpage=sa===undefined?1:sa;d.p.records=a.jgrid.getAccessor(s,w.records)||0;d.p.userData=a.jgrid.getAccessor(s,w.userdata)||{};w.repeatitems||($=ea=B(T));T=d.p.keyIndex===false?w.id:d.p.keyIndex;if(ea.length>0&&!isNaN(T)){if(d.p.remapColumns&&d.p.remapColumns.length)T=a.inArray(T,d.p.remapColumns);T=ea[T]}(ma=a.jgrid.getAccessor(s,w.root))||
(ma=[]);sa=ma.length;s=0;var Fa=parseInt(d.p.rowNum,10),Ba=d.p.scroll?(parseInt(d.p.page,10)-1)*Fa+1:1;if(D)Fa*=D+1;var wa=a.isFunction(d.p.afterInsertRow),Da={},Ha="";if(d.p.grouping&&d.p.groupingView.groupCollapse===true)Ha=' style="display:none;"';for(;s<sa;){D=ma[s];ha=a.jgrid.getAccessor(D,T);if(ha===undefined){ha=Ba+s;if(ea.length===0)if(w.cell)ha=D[w.cell][T]||ha}J=x===1?0:x;J=(J+s)%2==1?ta:"";Z.push("<tr"+Ha+' id="'+ha+'" role="row" class= "ui-widget-content jqgrow ui-row-'+d.p.direction+
""+J+'">');if(d.p.rownumbers===true){Z.push(z(0,s,d.p.page,d.p.rowNum));na=1}if(d.p.multiselect){Z.push(y(ha,na,s));ga=1}if(d.p.subGrid){Z.push(a(d).jqGrid("addSubGridCell",ga+na,s+x));R=1}if(w.repeatitems){if(w.cell)D=a.jgrid.getAccessor(D,w.cell);$||($=H(ga+R+na))}for(P=0;P<$.length;P++){J=a.jgrid.getAccessor(D,$[P]);Z.push(v(ha,J,P+ga+R+na,s+x,D));ja[d.p.colModel[P+ga+R+na].name]=J}Z.push("</tr>");if(d.p.grouping){J=d.p.groupingView.groupField.length;P=[];for(var Ea=0;Ea<J;Ea++)P.push(ja[d.p.groupingView.groupField[Ea]]);
Da=a(d).jqGrid("groupingPrepare",Z,P,Da,ja);Z=[]}if(W){ja[K]=ha;d.p.data.push(ja)}if(d.p.gridview===false){if(d.p.treeGrid===true){J=d.p.treeANode>-1?d.p.treeANode:0;Z=a(Z.join(""))[0];a(d.rows[s+J]).after(Z);try{a(d).jqGrid("setTreeNode",ja,Z)}catch(Ia){}}else a("#"+d.p.id+" tbody:first").append(Z.join(""));if(d.p.subGrid===true)try{a(d).jqGrid("addSubGrid",d.rows[d.rows.length-1],ga+na)}catch(Ka){}wa&&d.p.afterInsertRow.call(d,ha,ja,D);Z=[]}ja={};G++;s++;if(G==Fa)break}if(d.p.gridview===true)d.p.grouping?
a(d).jqGrid("groupingRender",Da,d.p.colModel.length):a("#"+d.p.id+" tbody:first").append(Z.join(""));d.p.totaltime=new Date-O;if(G>0)if(d.p.records===0)d.p.records=sa;if(!d.p.treeGrid&&!d.p.scroll)d.grid.bDiv.scrollTop=0;d.p.reccount=G;d.p.treeANode=-1;d.p.userDataOnFooter&&a(d).jqGrid("footerData","set",d.p.userData,true);if(W){d.p.records=sa;d.p.lastpage=Math.ceil(sa/Fa)}E||d.updatepager(false,true);if(W){for(;G<sa;){D=ma[G];ha=a.jgrid.getAccessor(D,T);if(ha===undefined){ha=Ba+G;if(ea.length===
0)if(w.cell)ha=D[w.cell][T]||ha}if(D){if(w.repeatitems){if(w.cell)D=a.jgrid.getAccessor(D,w.cell);$||($=H(ga+R+na))}for(P=0;P<$.length;P++){J=a.jgrid.getAccessor(D,$[P]);ja[d.p.colModel[P+ga+R+na].name]=J}ja[K]=ha;d.p.data.push(ja);ja={}}G++}u()}}},Q=function(){var s,w=false,x=[],E=[],D,O,K;if(a.isArray(d.p.data)){var T=d.p.grouping?d.p.groupingView:false;a.each(d.p.colModel,function(){O=this.sorttype||"text";if(O=="date"||O=="datetime"){if(this.formatter&&typeof this.formatter==="string"&&this.formatter==
"date"){D=this.formatoptions&&this.formatoptions.srcformat?this.formatoptions.srcformat:a.jgrid.formatter.date.srcformat;K=this.formatoptions&&this.formatoptions.newformat?this.formatoptions.newformat:a.jgrid.formatter.date.newformat}else D=K=this.datefmt||"Y-m-d";x[this.name]={stype:O,srcfmt:D,newfmt:K}}else x[this.name]={stype:O,srcfmt:"",newfmt:""};if(d.p.grouping&&this.name==T.groupField[0])E[0]=x[this.name];if(!w&&(this.index==d.p.sortname||this.name==d.p.sortname)){s=this.name;w=true}});if(d.p.treeGrid)a(d).jqGrid("SortTree",
后面还有 389 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。