+++ /dev/null
-;(function($){\r
-/**\r
- * jqGrid extension for manipulating columns properties\r
- * Piotr Roznicki roznicki@o2.pl\r
- * http://www.roznicki.prv.pl\r
- * Dual licensed under the MIT and GPL licenses:\r
- * http://www.opensource.org/licenses/mit-license.php\r
- * http://www.gnu.org/licenses/gpl.html\r
-**/\r
-$.fn.extend({\r
- setColumns : function(p) {\r
- p = $.extend({\r
- top : 0,\r
- left: 0,\r
- width: 200,\r
- height: 195,\r
- modal: false,\r
- drag: true,\r
- closeicon: 'ico-close.gif',\r
- beforeShowForm: null,\r
- afterShowForm: null,\r
- afterSubmitForm: null\r
- }, $.jgrid.col, p ||{});\r
- return this.each(function(){\r
- var $t = this;\r
- if (!$t.grid ) { return; }\r
- var onBeforeShow = typeof p.beforeShowForm === 'function' ? true: false;\r
- var onAfterShow = typeof p.afterShowForm === 'function' ? true: false;\r
- var onAfterSubmit = typeof p.afterSubmitForm === 'function' ? true: false; \r
- if(!p.imgpath) { p.imgpath= $t.p.imgpath; } // Added From Tony Tomov\r
- var gID = $("table:first",$t.grid.bDiv).attr("id");\r
- var IDs = {themodal:'colmod'+gID,modalhead:'colhd'+gID,modalcontent:'colcnt'+gID};\r
- var dtbl = "ColTbl_"+gID;\r
- if ( $("#"+IDs.themodal).html() != null ) {\r
- if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }\r
- viewModal("#"+IDs.themodal,{modal:p.modal});\r
- if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }\r
- } else {\r
- var tbl =$("<table id='"+dtbl+"' class='ColTable'><tbody></tbody></table>");\r
- for(i=0;i<this.p.colNames.length;i++){\r
- if(!$t.p.colModel[i].hidedlg) { // added from T. Tomov\r
- $(tbl).append("<tr><td ><input type='checkbox' id='col_" + this.p.colModel[i].name + "' class='cbox' value='T' " + \r
- ((this.p.colModel[i].hidden==undefined)?"checked":"") + "/>" + "<label for='col_" + this.p.colModel[i].name + "'>" + this.p.colNames[i] + "(" + this.p.colModel[i].name + ")</label></td></tr>");\r
- }\r
- }\r
- var bS ="<input id='dData' type='button' value='"+p.bSubmit+"'/>";\r
- var bC ="<input id='eData' type='button' value='"+p.bCancel+"'/>";\r
- $(tbl).append("<tr><td class='ColButton'>"+bS+" "+bC+"</td></tr>");\r
- createModal(IDs,tbl,p,$t.grid.hDiv,$t.grid.hDiv);\r
- if( p.drag) { DnRModal("#"+IDs.themodal,"#"+IDs.modalhead+" td.modaltext"); }\r
- $("#dData","#"+dtbl).click(function(e){\r
- for(i=0;i<$t.p.colModel.length;i++){\r
- if(!$t.p.colModel[i].hidedlg) { // added from T. Tomov\r
- if($("#col_" + $t.p.colModel[i].name).attr("checked")) {\r
- $($t).showCol($t.p.colModel[i].name);\r
- $("#col_" + $t.p.colModel[i].name).attr("defaultChecked",true); // Added from T. Tomov IE BUG\r
- } else {\r
- $($t).hideCol($t.p.colModel[i].name);\r
- $("#col_" + $t.p.colModel[i].name).attr("defaultChecked",""); // Added from T. Tomov IE BUG\r
- }\r
- }\r
- }\r
- $("#"+IDs.themodal).jqmHide();\r
- if (onAfterSubmit) { p.afterSubmitForm($("#"+dtbl)); }\r
- return false;\r
- });\r
- $("#eData", "#"+dtbl).click(function(e){\r
- $("#"+IDs.themodal).jqmHide();\r
- return false;\r
- });\r
- if(onBeforeShow) { p.beforeShowForm($("#"+dtbl)); }\r
- viewModal("#"+IDs.themodal,{modal:p.modal});\r
- if(onAfterShow) { p.afterShowForm($("#"+dtbl)); }\r
- }\r
- });\r
- }\r
-});\r
-})(jQuery);
\ No newline at end of file