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');
    注:两个方法,第二个参数都可以传递数组。
  • 相关阅读:
    windows下 python2 和python3 共存
    利用xshell远程连接centos安装oracle11g时在图形界面登录
    本地导入/导出远程oracle数据库
    centos7安装桌面环境
    普通用户修改.bash_profile 权限问题
    centos7 安装oracle11g
    Unable to fetch some archives ,maybe run apt-get update or try with --fix-missing?
    spring mvc 使用ehcache
    leaflet创建简单地图
    【BZOJ 3958】 3958: [WF2011]Mummy Madness (二分+扫描线、线段树)
  • 原文地址:https://www.cnblogs.com/LazyBee/p/2766677.html
Copyright © 2011-2022 走看看