zoukankan      html  css  js  c++  java
  • 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 };
    源代码改的
  • 相关阅读:
    idea git使用记录
    会计科目中的借贷理解
    git使用合集
    Unsupported major.minor version 52.0
    sts问题合集
    idea导入工程
    (转)解决mybatis的mapper.xml查询不出数据,结果一直为null问题
    战争热诚的python全栈开发之路
    Python机器学习笔记:SVM(4)——sklearn实现
    Python机器学习笔记:SVM(3)——证明SVM
  • 原文地址:https://www.cnblogs.com/lmaster/p/6273175.html
Copyright © 2011-2022 走看看