template.js.struts2.jquery.grid.struts2.min.js Maven / Gradle / Ivy
/*
jquery.grid.struts2.js
Integration of jqGrid with struts 2
Requires use of jquery.struts2.js
Copyright (c) 2010 - 2015 Johannes Geppert https://www.jgeppert.com
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
*/
'use strict';(function(l){l.struts2_jquery_grid={lastselectedrow:"",navigatorButtons:function(c,a,d){var b=this;l.each(a,function(a,e){if(e.title)if("seperator"===e.title)c.jqGrid("navSeparatorAdd",d);else if(e.topic||e.onclick)a={},e.id&&(a.id=e.id),e.title&&(a.title=e.title),e.position&&(a.position=e.position),a.caption=e.caption?e.caption:"",a.buttonicon=e.icon?e.icon:"ui-icon-gear",e.topic?a.onClickButton=function(){var a={};a.grid=c;b.publishTopic(c,e.topic,a)}:e.onclick&&(a.onClickButton=e.onclick),
c.jqGrid("navButtonAdd",d,a)})},parseGridParams:function(c,a,d){var b=this;if(a.onselectrowtopics||a.editurl&&!0===a.editinline)d.onSelectRow=function(e,g){var h={},f=null,d=null,k=null,n=null;h.id=e;h.status=g;h.grid=c;b.publishTopic(c,a.onalw,h);l.struts2_jquery.publishTopic(c,a.onselectrowtopics,h);a.editurl&&!0===a.editinline&&!1===a.navinline&&(""!==b.lastselectedrow&&c.jqGrid("restoreRow",b.lastselectedrow),b.lastselectedrow=e,a.oneibefore&&(f=function(){b.publishTopic(c,a.oneibefore,h)}),a.oneisuccess&&
(d=function(e){var g={};g.response=e;b.publishTopic(c,a.oneisuccess,g);return 400<=e.status?!1:!0}),a.oneierror&&(k=function(e,g){var h={};h.rowid=e;h.response=g;b.publishTopic(c,a.oneierror,h)}),a.oneisave&&(n=function(e,g){var h={};h.rowid=e;h.response=g;b.publishTopic(c,a.oneisave,h)}),c.jqGrid("editRow",e,!0,f,d,null,null,n,k,null))};a.oncesuccess&&(d.afterSaveCell=function(e,g,h,f,d){var k={};k.rowid=e;k.cellname=g;k.value=h;k.iRow=f;k.iCol=d;b.publishTopic(c,a.oncesuccess,k)});a.onceerror&&
(d.errorCell=function(e,g){var h={};h.response=e;h.status=g;b.publishTopic(c,a.onceerror,h)});a.onselectalltopics&&(d.onSelectAll=function(e,g){var h={};h.ids=e;h.status=g;h.grid=c;b.publishTopic(c,a.onalw,h);b.publishTopic(c,a.onselectalltopics,h)});a.onbef&&(d.loadBeforeSend=function(e){var g={};g.xhr=e;g.proceed=!0;b.publishTopic(c,a.onalw,g);b.publishTopic(c,a.onbef,g);return g.proceed});a.onpagingtopics&&(d.onPaging=function(e){var g={};g.pgButton=e;b.publishTopic(c,a.onalw,g);b.publishTopic(c,
a.onpagingtopics,g)});a.onsortcoltopics&&(d.onSortCol=function(e,g,h){var f={};f.index=e;f.iCol=g;f.sortorder=h;b.publishTopic(c,a.onalw,f);b.publishTopic(c,a.onsortcoltopics,f)});a.oncellselecttopics&&(d.onCellSelect=function(e,g,h,f){var d={};d.rowid=e;d.iCol=g;d.cellcontent=h;d.e=f;b.publishTopic(c,a.onalw,d);b.publishTopic(c,a.oncellselecttopics,d)});a.onclickgroup&&(d.onClickGroup=function(e,g){var h={};h.groupid=e;h.collapsed=g;b.publishTopic(c,a.onalw,h);b.publishTopic(c,a.onclickgroup,h)});
a.ondblclickrow&&(d.ondblClickRow=function(e,g,h,d){var f={};f.rowid=e;f.iRow=g;f.iCol=h;f.e=d;b.publishTopic(c,a.onalw,f);b.publishTopic(c,a.ondblclickrow,f)});a.onrightclickrow&&(d.onRightClickRow=function(e,g,h,d){var f={};f.rowid=e;f.iRow=g;f.iCol=h;f.e=d;b.publishTopic(c,a.onalw,f);b.publishTopic(c,a.onrightclickrow,f)});d.gridComplete=function(e){e=a.draggableoptions;var g=window[e],d=a.droppableoptions,f=window[d],l=a.sortableoptions,k=window[l],n=a.resizableoptions,p=window[n],m={},q={},r=
{};c.data("_s2jg_init")||(c.data("_s2jg_init",!0),a.draggable&&a.droppable&&(b.log("drag and drop for grid : "+a.id),b.loadAtOnce||b.require(["js/base/data"+b.minSuffix+".js","js/base/plugin"+b.minSuffix+".js","js/base/safe-active-element"+b.minSuffix+".js","js/base/safe-blur"+b.minSuffix+".js","js/base/scroll-parent"+b.minSuffix+".js","js/base/widget"+b.minSuffix+".js","js/base/mouse"+b.minSuffix+".js","js/base/draggable"+b.minSuffix+".js","js/base/droppable"+b.minSuffix+".js"]),g=g?{}:Function("return ("+
e+")")(),g.drap=b.pubTops(c,a.onalw,a.draggableondragtopics),f=f?{}:Function("return ("+d+")")(),f.activate=b.pubTops(c,a.onalw,a.droppableonactivatetopics),f.deactivate=b.pubTops(c,a.onalw,a.droppableondeactivatetopics),f.start=b.pubTops(c,a.onalw,a.droppableonstarttopics),f.stop=b.pubTops(c,a.onalw,a.droppableonstoptopics),m.drag_opts=g,m.drop_opts=f,m.connectWith=a.connectWith,m.onstart=b.pubTops(c,a.onalw,a.draggableonstarttopics),m.onstop=b.pubTops(c,a.onalw,a.draggableonstoptopics),m.ondrop=
b.pubTops(c,a.onalw,a.droppableondroptopics),c.jqGrid("gridDnD",m)),a.sortableRows&&(b.log("sortable rows for : "+a.id),k=!k&&l?Function("return ("+l+")")():{},k.beforeStop=b.pubTops(c,a.onalw,a.sortableonbeforestoptopics),k.stop=b.pubTops(c,a.onalw,a.sortableonstoptopics),k.start=b.pubTops(c,a.onalw,a.sortableonstarttopics),k.sort=b.pubTops(c,a.onalw,a.sortableonsorttopics),k.activate=b.pubTops(c,a.onalw,a.sortableonactivatetopics),k.deactivate=b.pubTops(c,a.onalw,a.sortableondeactivatetopics),k.over=
b.pubTops(c,a.onalw,a.sortableonovertopics),k.out=b.pubTops(c,a.onalw,a.sortableonouttopics),k.remove=b.pubTops(c,a.onalw,a.sortableonremovetopics),k.receive=b.pubTops(c,a.onalw,a.sortableonreceivetopics),k.change=b.pubTops(c,a.onalw,a.sortableonchangetopics),k.update=b.pubTops(c,a.onalw,a.sortableonupdatetopics),c.jqGrid("sortableRows",k)),a.navigator&&(q.add=a.navigatoradd,q.del=a.navigatordel,q.edit=a.navigatoredit,q.refresh=a.navigatorrefresh,q.search=a.navigatorsearch,q.view=a.navigatorview,
q.cloneToTop=a.cloneToTop,c.jqGrid("navGrid",b.escId(a.pager),q,a.navigatoreditoptions,a.navigatoraddoptions,a.navigatordeleteoptions,a.navigatorsearchoptions,a.navigatorviewoptions),!0===a.editinline&&!0===a.navinline&&c.jqGrid("inlineNav",b.escId(a.pager)),a.navigatorextrabuttons&&b.navigatorButtons(c,a.navigatorextrabuttons,b.escId(a.pager)),a.cloneToTop&&b.navigatorButtons(c,a.navigatorextrabuttons,b.escId(a.toppagerElem))),a.filter&&(a.filteroptions&&(r=a.filteroptions),c.jqGrid("filterToolbar",
r)),a.frozen&&c.jqGrid("setFrozenColumns"),a.resizable&&(b.loadAtOnce||b.require(["js/base/widget"+b.minSuffix+".js","js/base/mouse"+b.minSuffix+".js","js/base/disable-selection"+b.minSuffix+".js","js/base/plugin"+b.minSuffix+".js","js/base/version"+b.minSuffix+".js","js/base/resizable"+b.minSuffix+".js"]),p=p?{}:Function("return ("+n+")")(),p.start=b.pubTops(c,a.onalw,a.resizableonstarttopics),p.stop=b.pubTops(c,a.onalw,a.resizableonstoptopics),p.resize=b.pubTops(c,a.onalw,a.resizableonresizetopics),
c.jqGrid("gridResize",p)));a.ongridcompletetopics&&(b.publishTopic(c,a.onalwaystopics,{}),b.publishTopic(c,a.ongridcompletetopics,{}))};a.onfocustopics&&(d.beforeSelectRow=function(e,d){var g={};g.rowid=e;g.e=d;b.publishTopic(c,a.onalw,g);b.publishTopic(c,a.onfocustopics,g)});a.reloadtopics&&l.each(a.reloadtopics.split(","),function(b,d){c.subscribe(d,"_s2j_reloadgrid",a)});d.loadtext||null===b.defaults.loadingText||(d.loadtext=b.defaults.loadingText);d.loadComplete=b.pubCom(c,a.onalw,a.oncom,null,
null,a);d.loadError=b.pubErr(c,a.onalw,a.onerr,a.errortext);a.grouping&&b.require("js/plugins/grid.grouping"+b.minSuffix+".js");a.editurl&&(b.require(["js/plugins/grid.filter"+b.minSuffix+".js","js/plugins/grid.formedit"+b.minSuffix+".js"]),a.editinline&&b.require("js/plugins/grid.inlinedit"+b.minSuffix+".js"));a.cellurl&&b.require("js/plugins/grid.celledit"+b.minSuffix+".js");a.navigator&&b.require("js/plugins/grid.formedit"+b.minSuffix+".js");a.navigatorsearch&&b.require("js/plugins/grid.filter"+
b.minSuffix+".js");a.subgrid?(b.require("js/plugins/grid.subgrid"+b.minSuffix+".js"),d.subGrid=!0,d.gridview=!1,d.subGridRowExpanded=function(e,d){var g={},f=a.subgridoptions,m=e.replace(/(:|\.)/g,"\\$1")+"_table",k=l(b.escId(e)),n="\x3ctable id\x3d'"+m+"' class\x3d'scroll'\x3e\x3c/table\x3e",p=f.url.indexOf("?");g.proceed=!0;a.onsgrowexpanded&&(g.row_id=d,g.subgrid_id=e,b.publishTopic(c,a.onalw,g),b.publishTopic(c,a.onsgrowexpanded,g));d=escape(d);if(g.proceed){if(f.pager&&""!==f.pager||f.navigator)n=
n+"\x3cdiv id\x3d'"+e.replace(/(:|\.)/g,"\\$1")+"_pager'\x3e\x3c/div\x3e",f.pager=e.replace(/(:|\.)/g,"\\$1")+"_pager",f.navigatoraddoptions=l.extend(!0,f.navigatoraddoptions||{},{editData:{rowid:d}}),f.navigatoreditoptions=l.extend(!0,f.navigatoreditoptions||{},{editData:{rowid:d}}),f.navigatordeleteoptions=l.extend(!0,f.navigatordeleteoptions||{},{delData:{rowid:d}});l.each(f.colModel,function(a,c){c.editoptions&&c.editoptions.dataUrl&&(0
© 2015 - 2025 Weber Informatics LLC | Privacy Policy