Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
template.js.plugins.grid.formedit.min.js Maven / Gradle / Ivy
'use strict';(function(a){var b={};a.jgrid.extend({searchGrid:function(b){b=a.extend(!0,{recreateFilter:!1,drag:!0,sField:"searchField",sValue:"searchString",sOper:"searchOper",sFilter:"filters",loadDefaults:!0,beforeShowSearch:null,afterShowSearch:null,onInitializeSearch:null,afterRedraw:null,afterChange:null,closeAfterSearch:!1,closeAfterReset:!1,closeOnEscape:!1,searchOnEnter:!1,multipleSearch:!1,multipleGroup:!1,top:0,left:0,jqModal:!0,modal:!1,resize:!0,width:450,height:"auto",dataheight:"auto",
showQuery:!1,errorcheck:!0,sopt:null,stringResult:void 0,onClose:null,onSearch:null,onReset:null,toTop:!0,overlay:30,columns:[],tmplNames:null,tmplFilters:null,tmplLabel:" Template: ",showOnLoad:!1,layer:null,operands:{eq:"\x3d",ne:"\x3c\x3e",lt:"\x3c",le:"\x3c\x3d",gt:"\x3e",ge:"\x3e\x3d",bw:"LIKE",bn:"NOT LIKE","in":"IN",ni:"NOT IN",ew:"LIKE",en:"NOT LIKE",cn:"LIKE",nc:"NOT LIKE",nu:"IS NULL",nn:"ISNOT NULL"}},a.jgrid.search,b||{});return this.each(function(){function d(c){w=a(e).triggerHandler("jqGridFilterBeforeShow",
[c]);void 0===w&&(w=!0);w&&a.isFunction(b.beforeShowSearch)&&(w=b.beforeShowSearch.call(e,c));w&&(a.jgrid.viewModal("#"+a.jgrid.jqID(t.themodal),{gbox:"#gbox_"+a.jgrid.jqID(k),jqm:b.jqModal,modal:b.modal,overlay:b.overlay,toTop:b.toTop}),a(e).triggerHandler("jqGridFilterAfterShow",[c]),a.isFunction(b.afterShowSearch)&&b.afterShowSearch.call(e,c))}var e=this;if(e.grid){var k="fbox_"+e.p.id,w=!0,p=!0,t={themodal:"searchmod"+k,modalhead:"searchhd"+k,modalcontent:"searchcnt"+k,scrollelm:k},m=e.p.postData[b.sFilter],
f;"string"===typeof m&&(m=a.jgrid.parse(m));!0===b.recreateFilter&&a("#"+a.jgrid.jqID(t.themodal)).remove();if(void 0!==a("#"+a.jgrid.jqID(t.themodal))[0])d(a("#fbox_"+a.jgrid.jqID(+e.p.id)));else{var g=a("\x3cdiv\x3e\x3cdiv id\x3d'"+k+"' class\x3d'searchFilter' style\x3d'overflow:auto'\x3e\x3c/div\x3e\x3c/div\x3e").insertBefore("#gview_"+a.jgrid.jqID(e.p.id)),q="left",x="";"rtl"===e.p.direction&&(q="right",x=" style\x3d'text-align:left'",g.attr("dir","rtl"));var c=a.extend([],e.p.colModel),v="\x3ca id\x3d'"+
k+"_search' class\x3d'fm-button ui-state-default ui-corner-all fm-button-icon-right ui-reset'\x3e\x3cspan class\x3d'ui-icon ui-icon-search'\x3e\x3c/span\x3e"+b.Find+"\x3c/a\x3e",h="\x3ca id\x3d'"+k+"_reset' class\x3d'fm-button ui-state-default ui-corner-all fm-button-icon-left ui-search'\x3e\x3cspan class\x3d'ui-icon ui-icon-arrowreturnthick-1-w'\x3e\x3c/span\x3e"+b.Reset+"\x3c/a\x3e",r="",n="",u,y=!1,C=-1;b.showQuery&&(r="\x3ca id\x3d'"+k+"_query' class\x3d'fm-button ui-state-default ui-corner-all fm-button-icon-left'\x3e\x3cspan class\x3d'ui-icon ui-icon-comment'\x3e\x3c/span\x3eQuery\x3c/a\x3e");
b.columns.length?(c=b.columns,C=0,u=c[0].index||c[0].name):a.each(c,function(a,b){b.label||(b.label=e.p.colNames[a]);if(!y){var c=void 0===b.search?!0:b.search,d=!0===b.hidden;if(b.searchoptions&&!0===b.searchoptions.searchhidden&&c||c&&!d)y=!0,u=b.index||b.name,C=a}});if(!m&&u||!1===b.multipleSearch){var A="eq";0<=C&&c[C].searchoptions&&c[C].searchoptions.sopt?A=c[C].searchoptions.sopt[0]:b.sopt&&b.sopt.length&&(A=b.sopt[0]);m={groupOp:"AND",rules:[{field:u,op:A,data:""}]}}y=!1;b.tmplNames&&b.tmplNames.length&&
(y=!0,n=b.tmplLabel,n+="\x3cselect class\x3d'ui-template'\x3e",n+="\x3coption value\x3d'default'\x3eDefault\x3c/option\x3e",a.each(b.tmplNames,function(a,b){n+="\x3coption value\x3d'"+a+"'\x3e"+b+"\x3c/option\x3e"}),n+="\x3c/select\x3e");q="\x3ctable class\x3d'EditTable' style\x3d'border:0px none;margin-top:5px' id\x3d'"+k+"_2'\x3e\x3ctbody\x3e\x3ctr\x3e\x3ctd colspan\x3d'2'\x3e\x3chr class\x3d'ui-widget-content' style\x3d'margin:1px'/\x3e\x3c/td\x3e\x3c/tr\x3e\x3ctr\x3e\x3ctd class\x3d'EditButton' style\x3d'text-align:"+
q+"'\x3e"+h+n+"\x3c/td\x3e\x3ctd class\x3d'EditButton' "+x+"\x3e"+r+v+"\x3c/td\x3e\x3c/tr\x3e\x3c/tbody\x3e\x3c/table\x3e";k=a.jgrid.jqID(k);a("#"+k).jqFilter({columns:c,filter:b.loadDefaults?m:null,showQuery:b.showQuery,errorcheck:b.errorcheck,sopt:b.sopt,groupButton:b.multipleGroup,ruleButtons:b.multipleSearch,afterRedraw:b.afterRedraw,ops:b.odata,operands:b.operands,ajaxSelectOptions:e.p.ajaxSelectOptions,groupOps:b.groupOps,onChange:function(){this.p.showQuery&&a(".query",this).html(this.toUserFriendlyString());
a.isFunction(b.afterChange)&&b.afterChange.call(e,a("#"+k),b)},direction:e.p.direction,id:e.p.id});g.append(q);y&&b.tmplFilters&&b.tmplFilters.length&&a(".ui-template",g).bind("change",function(){var c=a(this).val();"default"===c?a("#"+k).jqFilter("addFilter",m):a("#"+k).jqFilter("addFilter",b.tmplFilters[parseInt(c,10)]);return!1});!0===b.multipleGroup&&(b.multipleSearch=!0);a(e).triggerHandler("jqGridFilterInitialize",[a("#"+k)]);a.isFunction(b.onInitializeSearch)&&b.onInitializeSearch.call(e,a("#"+
k));b.gbox="#gbox_"+k;b.layer?a.jgrid.createModal(t,g,b,"#gview_"+a.jgrid.jqID(e.p.id),a("#gbox_"+a.jgrid.jqID(e.p.id))[0],"#"+a.jgrid.jqID(b.layer),{position:"relative"}):a.jgrid.createModal(t,g,b,"#gview_"+a.jgrid.jqID(e.p.id),a("#gbox_"+a.jgrid.jqID(e.p.id))[0]);(b.searchOnEnter||b.closeOnEscape)&&a("#"+a.jgrid.jqID(t.themodal)).keydown(function(c){var d=a(c.target);if(!(!b.searchOnEnter||13!==c.which||d.hasClass("add-group")||d.hasClass("add-rule")||d.hasClass("delete-group")||d.hasClass("delete-rule")||
d.hasClass("fm-button")&&d.is("[id$\x3d_query]")))return a("#"+k+"_search").click(),!1;if(b.closeOnEscape&&27===c.which)return a("#"+a.jgrid.jqID(t.modalhead)).find(".ui-jqdialog-titlebar-close").click(),!1});r&&a("#"+k+"_query").bind("click",function(){a(".queryresult",g).toggle();return!1});void 0===b.stringResult&&(b.stringResult=b.multipleSearch);a("#"+k+"_search").bind("click",function(){var c={},d,h;f=a("#"+k);f.find(".input-elm:focus").change();h=f.jqFilter("filterData");if(b.errorcheck&&(f[0].hideError(),
b.showQuery||f.jqFilter("toSQLString"),f[0].p.error))return f[0].showError(),!1;if(b.stringResult){try{d=xmlJsonClass.toJson(h,"","",!1)}catch(g){try{d=JSON.stringify(h)}catch(l){}}"string"===typeof d&&(c[b.sFilter]=d,a.each([b.sField,b.sValue,b.sOper],function(){c[this]=""}))}else b.multipleSearch?(c[b.sFilter]=h,a.each([b.sField,b.sValue,b.sOper],function(){c[this]=""})):(c[b.sField]=h.rules[0].field,c[b.sValue]=h.rules[0].data,c[b.sOper]=h.rules[0].op,c[b.sFilter]="");e.p.search=!0;a.extend(e.p.postData,
c);p=a(e).triggerHandler("jqGridFilterSearch");void 0===p&&(p=!0);p&&a.isFunction(b.onSearch)&&(p=b.onSearch.call(e,e.p.filters));!1!==p&&a(e).trigger("reloadGrid",[{page:1}]);b.closeAfterSearch&&a.jgrid.hideModal("#"+a.jgrid.jqID(t.themodal),{gb:"#gbox_"+a.jgrid.jqID(e.p.id),jqm:b.jqModal,onClose:b.onClose});return!1});a("#"+k+"_reset").bind("click",function(){var c={},d=a("#"+k);e.p.search=!1;e.p.resetsearch=!0;!1===b.multipleSearch?c[b.sField]=c[b.sValue]=c[b.sOper]="":c[b.sFilter]="";d[0].resetFilter();
y&&a(".ui-template",g).val("default");a.extend(e.p.postData,c);p=a(e).triggerHandler("jqGridFilterReset");void 0===p&&(p=!0);p&&a.isFunction(b.onReset)&&(p=b.onReset.call(e));!1!==p&&a(e).trigger("reloadGrid",[{page:1}]);b.closeAfterReset&&a.jgrid.hideModal("#"+a.jgrid.jqID(t.themodal),{gb:"#gbox_"+a.jgrid.jqID(e.p.id),jqm:b.jqModal,onClose:b.onClose});return!1});d(a("#"+k));a(".fm-button:not(.ui-state-disabled)",g).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},
editGridRow:function(z,d){d=a.extend(!0,{top:0,left:0,width:300,datawidth:"auto",height:"auto",dataheight:"auto",modal:!1,overlay:30,drag:!0,resize:!0,url:null,mtype:"POST",clearAfterAdd:!0,closeAfterEdit:!1,reloadAfterSubmit:!0,onInitializeForm:null,beforeInitData:null,beforeShowForm:null,afterShowForm:null,beforeSubmit:null,afterSubmit:null,onclickSubmit:null,afterComplete:null,onclickPgButtons:null,afterclickPgButtons:null,editData:{},recreateForm:!1,jqModal:!0,closeOnEscape:!1,addedrow:"first",
topinfo:"",bottominfo:"",saveicon:[],closeicon:[],savekey:[!1,13],navkeys:[!1,38,40],checkOnSubmit:!1,checkOnUpdate:!1,_savedData:{},processing:!1,onClose:null,ajaxEditOptions:{},serializeEditData:null,viewPagerButtons:!0,overlayClass:"ui-widget-overlay",removemodal:!0,form:"edit"},a.jgrid.edit,d||{});b[a(this)[0].p.id]=d;return this.each(function(){function e(){a(n+" \x3e tbody \x3e tr \x3e td .FormElement").each(function(){var b=a(".customelement",this);if(b.length){var d=a(b[0]).attr("name");a.each(c.p.colModel,
function(){if(this.name===d&&this.editoptions&&a.isFunction(this.editoptions.custom_value)){try{if(l[d]=this.editoptions.custom_value.call(c,a("#"+a.jgrid.jqID(d),n),"get"),void 0===l[d])throw"e1";}catch(b){"e1"===b?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+a.jgrid.edit.msg.novalue,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,b.message,a.jgrid.edit.bClose)}return!0}})}else{switch(a(this).get(0).type){case "checkbox":a(this).is(":checked")?l[this.name]=
a(this).val():(b=a(this).attr("offval"),l[this.name]=b);break;case "select-one":l[this.name]=a("option:selected",this).val();break;case "select-multiple":l[this.name]=a(this).val();l[this.name]=l[this.name]?l[this.name].join(","):"";a("option:selected",this).each(function(b,c){a(c).text()});break;case "password":case "text":case "textarea":case "button":l[this.name]=a(this).val()}c.p.autoencode&&(l[this.name]=a.jgrid.htmlEncode(l[this.name]))}});return!0}function k(d,e,s,g){var l,f,n,k=0,m,u,q,r=
[],D=!1,z="",p;for(p=1;p<=g;p++)z+="\x3ctd class\x3d'CaptionTD'\x3e\x26#160;\x3c/td\x3e\x3ctd class\x3d'DataTD'\x3e\x26#160;\x3c/td\x3e";"_empty"!==d&&(D=a(e).jqGrid("getInd",d));a(e.p.colModel).each(function(p){l=this.name;u=(f=this.editrules&&!0===this.editrules.edithidden?!1:!0===this.hidden?!0:!1)?"style\x3d'display:none'":"";if("cb"!==l&&"subgrid"!==l&&!0===this.editable&&"rn"!==l){if(!1===D)m="";else if(l===e.p.ExpandColumn&&!0===e.p.treeGrid)m=a("td[role\x3d'gridcell']:eq("+p+")",e.rows[D]).text();
else{try{m=a.unformat.call(e,a("td[role\x3d'gridcell']:eq("+p+")",e.rows[D]),{rowId:d,colModel:this},p)}catch(w){m=this.edittype&&"textarea"===this.edittype?a("td[role\x3d'gridcell']:eq("+p+")",e.rows[D]).text():a("td[role\x3d'gridcell']:eq("+p+")",e.rows[D]).html()}if(!m||"\x26nbsp;"===m||"\x26#160;"===m||1===m.length&&160===m.charCodeAt(0))m=""}var t=a.extend({},this.editoptions||{},{id:l,name:l,rowId:d}),v=a.extend({},{elmprefix:"",elmsuffix:"",rowabove:!1,rowcontent:""},this.formoptions||{}),
y=parseInt(v.rowpos,10)||k+1,A=parseInt(2*(parseInt(v.colpos,10)||1),10);"_empty"===d&&t.defaultValue&&(m=a.isFunction(t.defaultValue)?t.defaultValue.call(c):t.defaultValue);this.edittype||(this.edittype="text");c.p.autoencode&&(m=a.jgrid.htmlDecode(m));q=a.jgrid.createEl.call(c,this.edittype,t,m,!1,a.extend({},a.jgrid.ajaxOptions,e.p.ajaxSelectOptions||{}));if(b[c.p.id].checkOnSubmit||b[c.p.id].checkOnUpdate)b[c.p.id]._savedData[l]=m;a(q).addClass("FormElement");-1u.search(/(false|f|0|no|n|off|undefined)/i)&&""!==u?(f[0].checked=!0,f[0].defaultChecked=!0,f[0].value=k):(f[0].checked=!1,f[0].defaultChecked=!1)):f.val(k)):"checkbox"===f[0].type?(f[0].checked=!1,f[0].defaultChecked=!1,k=a(f).attr("offval")):f[0].type&&"select"===f[0].type.substr(0,6)?f[0].selectedIndex=0:f.val(k),!0===b[c.p.id].checkOnSubmit||
b[c.p.id].checkOnUpdate)&&(b[c.p.id]._savedData[l]=k)}),a("#id_g","#"+s).val(d);else{var q=a(e).jqGrid("getInd",d,!0);q&&(a('td[role\x3d"gridcell"]',q).each(function(f){l=p[f].name;if("cb"!==l&&"subgrid"!==l&&"rn"!==l&&!0===p[f].editable){if(l===e.p.ExpandColumn&&!0===e.p.treeGrid)g=a(this).text();else try{g=a.unformat.call(e,a(this),{rowId:d,colModel:p[f]},f)}catch(m){g="textarea"===p[f].edittype?a(this).text():a(this).html()}c.p.autoencode&&(g=a.jgrid.htmlDecode(g));if(!0===b[c.p.id].checkOnSubmit||
b[c.p.id].checkOnUpdate)b[c.p.id]._savedData[l]=g;l=a.jgrid.jqID(l);switch(p[f].edittype){case "password":case "text":case "button":case "image":case "textarea":if("\x26nbsp;"===g||"\x26#160;"===g||1===g.length&&160===g.charCodeAt(0))g="";a("#"+l,"#"+s).val(g);break;case "select":var k=g.split(","),k=a.map(k,function(b){return a.trim(b)});a("#"+l+" option","#"+s).each(function(){p[f].editoptions.multiple||a.trim(g)!==a.trim(a(this).text())&&k[0]!==a.trim(a(this).text())&&k[0]!==a.trim(a(this).val())?
p[f].editoptions.multiple?-1g.search(/(false|f|0|no|n|off|undefined)/i)&&
""!==g?(a("#"+l,"#"+s)[c.p.useProp?"prop":"attr"]("checked",!0),a("#"+l,"#"+s)[c.p.useProp?"prop":"attr"]("defaultChecked",!0)):(a("#"+l,"#"+s)[c.p.useProp?"prop":"attr"]("checked",!1),a("#"+l,"#"+s)[c.p.useProp?"prop":"attr"]("defaultChecked",!1));break;case "custom":try{if(p[f].editoptions&&a.isFunction(p[f].editoptions.custom_value))p[f].editoptions.custom_value.call(c,a("#"+l,"#"+s),"set",g);else throw"e1";}catch(n){"e1"===n?a.jgrid.info_dialog(a.jgrid.errors.errcap,"function 'custom_value' "+
a.jgrid.edit.msg.nodefined,a.jgrid.edit.bClose):a.jgrid.info_dialog(a.jgrid.errors.errcap,n.message,a.jgrid.edit.bClose)}}h++}}),0b.rp?1:a.rpb.rp?1:a.rpf.p._nvtd[0]&&
(a(r+"_"+d.position,r).width(g),f.p._nvtd[0]=g),f.p._nvtd[1]=g);h=g=g=null;this.nav=!0}}}})},navButtonAdd:function(b,d){d=a.extend({caption:"newButton",title:"",buttonicon:"ui-icon-newwin",onClickButton:null,position:"last",cursor:"pointer"},d||{});return this.each(function(){if(this.grid){"string"===typeof b&&0!==b.indexOf("#")&&(b="#"+a.jgrid.jqID(b));var e=a(".navtable",b)[0],k=this;if(e&&(!d.id||void 0===a("#"+a.jgrid.jqID(d.id),e)[0])){var w=a("\x3ctd\x3e\x3c/td\x3e");"NONE"===d.buttonicon.toString().toUpperCase()?
a(w).addClass("ui-pg-button ui-corner-all").append("\x3cdiv class\x3d'ui-pg-div'\x3e"+d.caption+"\x3c/div\x3e"):a(w).addClass("ui-pg-button ui-corner-all").append("\x3cdiv class\x3d'ui-pg-div'\x3e\x3cspan class\x3d'ui-icon "+d.buttonicon+"'\x3e\x3c/span\x3e"+d.caption+"\x3c/div\x3e");d.id&&a(w).attr("id",d.id);"first"===d.position?0===e.rows[0].cells.length?a("tr",e).append(w):a("tr td:eq(0)",e).before(w):a("tr",e).append(w);a(w,e).attr("title",d.title||"").click(function(b){a(this).hasClass("ui-state-disabled")||
a.isFunction(d.onClickButton)&&d.onClickButton.call(k,b);return!1}).hover(function(){a(this).hasClass("ui-state-disabled")||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")})}}})},navSeparatorAdd:function(b,d){d=a.extend({sepclass:"ui-separator",sepcontent:"",position:"last"},d||{});return this.each(function(){if(this.grid){"string"===typeof b&&0!==b.indexOf("#")&&(b="#"+a.jgrid.jqID(b));var e=a(".navtable",b)[0];if(e){var k="\x3ctd class\x3d'ui-pg-button ui-state-disabled' style\x3d'width:4px;'\x3e\x3cspan class\x3d'"+
d.sepclass+"'\x3e\x3c/span\x3e"+d.sepcontent+"\x3c/td\x3e";"first"===d.position?0===e.rows[0].cells.length?a("tr",e).append(k):a("tr td:eq(0)",e).before(k):a("tr",e).append(k)}}})},GridToForm:function(b,d){return this.each(function(){var e=this,k;if(e.grid){var w=a(e).jqGrid("getRowData",b);if(w)for(k in w)w.hasOwnProperty(k)&&(a("[name\x3d"+a.jgrid.jqID(k)+"]",d).is("input:radio")||a("[name\x3d"+a.jgrid.jqID(k)+"]",d).is("input:checkbox")?a("[name\x3d"+a.jgrid.jqID(k)+"]",d).each(function(){if(a(this).val()==
w[k])a(this)[e.p.useProp?"prop":"attr"]("checked",!0);else a(this)[e.p.useProp?"prop":"attr"]("checked",!1)}):a("[name\x3d"+a.jgrid.jqID(k)+"]",d).val(w[k]))}})},FormToGrid:function(b,d,e,k){return this.each(function(){if(this.grid){e||(e="set");k||(k="first");var w=a(d).serializeArray(),p={};a.each(w,function(a,b){p[b.name]=b.value});"add"===e?a(this).jqGrid("addRowData",b,p,k):"set"===e&&a(this).jqGrid("setRowData",b,p)}})}})})(jQuery);