zoukankan      html  css  js  c++  java
  • [转]扩展jQuery easyui datagrid增加动态改变列编辑的类型

    $.extend($.fn.datagrid.methods, {
        addEditor : function(jq, param) {
            if (param instanceof Array) {
                $.each(param, function(index, item) {
                    var e = $(jq).datagrid('getColumnOption', item.field);
                    e.editor = item.editor;
                });
            } else {
                var e = $(jq).datagrid('getColumnOption', param.field);
                e.editor = param.editor;
            }
        },
        removeEditor : function(jq, param) {
            if (param instanceof Array) {
                $.each(param, function(index, item) {
                    var e = $(jq).datagrid('getColumnOption', item);
                    e.editor = {};
                });
            } else {
                var e = $(jq).datagrid('getColumnOption', param);
                e.editor = {};
            }
        }
    }); 
    使用方式: 

    为password字段添加一个editor 

    1
    $("#gridId").datagrid('addEditor', {
    2
                            field : 'password',
    3
                            editor : {
    4
                                type : 'validatebox',
    5
                                options : {
    6
                                    required : true
    7
                                }
    8
                            }
    9

                        });

    删除password的editor
    1$("#gridid").datagrid('removeEditor''password');
    注:两个方法,第二个参数都可以传递数组。
  • 相关阅读:
    php 日期处理 DateTime
    http范围请求
    fiddle扩展
    汉字编码 (GB2312 GBK GB18030)
    Navicat http 通道增加验证
    vim 支持 nginx配置文件 语法高亮
    composer 使用
    剖析nsq消息队列(三) 消息传输的可靠性和持久化[一]
    剖析nsq消息队列(二) 去中心化源码解析
    剖析nsq消息队列(一) 简介及去中心化实现原理
  • 原文地址:https://www.cnblogs.com/LazyBee/p/2766677.html
Copyright © 2011-2022 走看看