zoukankan      html  css  js  c++  java
  • easyui datagrid 自定义editor并根据实际情况(自定义options)判断返回多样的html控件

    在添加的时候全部列都变成编辑状态,编辑的时候某些列不变成编辑状态,解决方法
    
    1 自定义editor
    
    
    $.extend($.fn.datagrid.defaults.editors, {
        Uploadfile: {//Uploadfile就是你要自定义editor的名称   
            init: function (container, options) {
                 /////通过options传参数
                var status = $("#hidMode").val();
                if (status == 'edit') {
                    var input = $("<a href='#' style='cursor:pointer;' value='" + options.url + "'  onclick='ShowFile(this.value)'  ></a>")
                               .appendTo(container);
                }
                else {
                    var input = $("<input type='file'  id='Uploadfile'  name='Uploadfile'/>")
                              .appendTo(container);
                }
                return input;
            },
            getValue: function (target) {
    
                return $(target).val();
            },
            setValue: function (target, value) {
                var status = $("#hidMode").val();
                if (status == 'edit') {
                    $(target).val($(target).val() + value);
                    $(target).text(value);
                }
                else {
                    $(target).val(value);
                }
            },
            resize: function (target, width) {
                var input = $(target);
                if ($.boxModel == true) {
                    input.width(80);
                } else {
                    input.width(width);
                }
            }
        }
    });
    
    
    dataGrid 使用 自定义editors
    
    {
    field: '文件名称', title: '文件名称',  getWidth(0.1), align: 'left', sortable: true,
     editor: {
     type: 'Uploadfile', 
    options: { status: '', url: '/UploadFiles/MaterialFile/'}
             }
    }
    ///options里面不可以使用 value,传输的参数是文本
  • 相关阅读:
    websocketpp相关
    大地水准面、大地基准面
    ubuntu18.04 和 qt 5.13.1 安装
    高斯——克吕格投影反算
    高斯——克吕格投影正算
    缓和曲线10麦克康奈尔
    vsCode 需安装的扩展
    显示windows电脑上已连接过的wifi密码
    linux Java项目CPU内存占用高故障排查
    tcpdump常用参数说明及常见操作
  • 原文地址:https://www.cnblogs.com/hbhzz/p/4075666.html
Copyright © 2011-2022 走看看