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


     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 };
    源代码改的
  • 相关阅读:
    spawn-fcgi
    JSP EL表达式
    关于订阅号和自定义菜单的关系问题
    微信公众平台开发(74) 用户分组管理
    微信公众平台开发(73) 客服接口发送客服消息
    用数据分析寻找下一位苍井空
    微商城
    微信支付体验
    微信公众平台开发(72)第三方接口
    微信公众平台开发(71)OAuth2.0网页授权
  • 原文地址:https://www.cnblogs.com/lmaster/p/6273175.html
Copyright © 2020-2023  润新知