码迷,mamicode.com
首页 > 其他好文 > 详细

JqGrid在行中自定义自己的东西

时间:2017-01-11 14:02:44      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:get   click   his   form   tle   lin   cursor   false   inline   

 1 $.fn.fmatter.actions = function(cellval, opts) {
 2     function baseOption(obj) {
 3         return {
 4             url: obj.url || ‘‘,
 5             icon: obj.icon || ‘‘,
 6             text: obj.text || ‘‘,
 7             message: obj.message || ‘‘,
 8             func: obj.func || ‘‘
 9         }
10     }
11 
12     function getUrl(url, id) {
13         return url.indexOf(‘?‘) > 0 ? url + "&id=" + id : url + "?id=" + id;
14     }
15     var op = {
16             keys: false,
17             editbutton: true,
18             delbutton: true,
19             editformbutton: false,
20             viewformbutton: false
21         },
22         rowid = opts.rowId,
23         str = "",
24         ocl;
25     if (opts.colModel.formatoptions !== undefined) {
26         op = $.extend(op, opts.colModel.formatoptions);
27     }
28     if (rowid === undefined || $.fmatter.isEmpty(rowid)) {
29         return "";
30     }
31     if (op.custombutton) {
32         for (var i = 0; i < op.custombutton.length; i++) {
33             var customoption = baseOption(op.custombutton[i]);
34             var url = getUrl(customoption.url, rowid);
35             console.log(customoption);
36             if (customoption.func != ‘‘) {
37                 ocl = "id=‘jViewButton_" + rowid + "‘ onclick=" + customoption.func + "(" + rowid + ",this); onmouseover=jQuery(this).addClass(‘ui-state-hover‘); onmouseout=jQuery(this).removeClass(‘ui-state-hover‘);  ";
38             } else {
39                 ocl = "id=‘jViewButton_" + rowid + "‘ onclick=jqGridDialog(‘" + url + "‘,‘" + customoption.message + "‘); onmouseover=jQuery(this).addClass(‘ui-state-hover‘); onmouseout=jQuery(this).removeClass(‘ui-state-hover‘);  ";
40             }
41 
42             str += "<div title=‘" + customoption.text + "‘  style=‘float:left;cursor:pointer;margin-right:5px;‘ class=‘ui-pg-div ui-inline-edit‘ " + ocl + "><span class=‘ui-icon " + customoption.icon + "‘></span></div>";
43         }
44     }
45     return "<div style=‘margin-left:8px;‘>" + str + "</div>";
46 };
源代码改的

JqGrid在行中自定义自己的东西

标签:get   click   his   form   tle   lin   cursor   false   inline   

原文地址:http://www.cnblogs.com/lmaster/p/6273175.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!