1$.fn.fmatter.actions =function(Cellval, opts) {2 functionbaseoption (obj) {3 return {4Url:obj.url | | ‘‘,5Icon:obj.icon | | ‘‘,6Text:obj.text | | ‘‘,7Message:obj.message | | ‘‘,8Func:obj.func | | ‘‘9 }Ten } One A functiongetUrl (URL, id) { - returnUrl.indexof ('? ') > 0? URL + "&id=" + Id:url + "? id=" +ID; - } the varOP = { -Keysfalse, -Editbutton:true, -Delbutton:true, +Editformbutton:false, -Viewformbutton:false + }, ArowID =Opts.rowid, atstr = "", - OCL; - if(Opts.colModel.formatoptions!==undefined) { -OP =$.extend (OP, opts.colModel.formatoptions); - } - if(rowID = = = Undefined | |$.fmatter.isempty (ROWID)) { in return""; - } to if(Op.custombutton) { + for(vari = 0; i < op.custombutton.length; i++) { - varCustomoption =baseoption (Op.custombutton[i]); the varURL =GetUrl (Customoption.url, rowid); * Console.log (customoption); $ if(Customoption.func! = ") {Panax NotoginsengOCL = "Id= ' Jviewbutton_" + rowid + "' onclick=" + Customoption.func + "(" + rowID + ", this); Onmouseover=jquery (This). addclass (' Ui-state-hover '); Onmouseout=jquery (This). Removeclass (' Ui-state-hover '); "; -}Else { theOCL = "Id= ' Jviewbutton_" + rowid + "' onclick=jqgriddialog (' + URL + ' ', ' + Customoption.message + '); Onmouseover=jquery (This). addclass (' Ui-state-hover '); Onmouseout=jquery (This). Removeclass (' Ui-state-hover '); "; + } A thestr + = "<div title=" + customoption.text + "' style= ' float:left;cursor:pointer;margin-right:5px; ' class= ' Ui-pg-div u I-inline-edit ' "+ OCL +" ><span class= ' Ui-icon "+ Customoption.icon +" ' ></span></div> "; + } - } $ return"<div style= ' margin-left:8px; ' > "+ str +" </div> "; $};
The source code changes
Jqgrid Customize your own stuff in the row