zoukankan      html  css  js  c++  java
  • easyui grid 里的可编辑text 加清空图标

        $.extend($.fn.datagrid.defaults.editors, {
            text: {
                init: function (container, options) {
                    var _opt = $('<input type="text" class="datagrid-editable-input">');
                    var curField = container.prevObject.prevObject.attr('field'); 
                    if (curField == "我们需要加清空的字段" ) {   
                        var button = $('<input type="text" class="easyui-textbox"> ').appendTo(container);
                        button.textbox({ 
                            //添加清除图标
                            icons: [{
                                iconCls: 'icon-clear',
                                handler: function (e) {
                                    button.textbox('clear');
    
                       //modelTextClear 是自定义清除 grid 里数据 的函数
                                    modelTextClear(curField);
                                }
                            }]
                        });
    
                        if (typeof (options.onClick) == 'function') {
                            var el = button.next().children('.textbox-text');
                            el.click(function () {
                                options.onClick(el);
                            });
                        }
     
                        return button; 
                    }
                    if (typeof (options.onChange) == 'function') {
                        _opt.change(function () {
                            options.onChange(_opt);
                        });
                    }
                    if (typeof (options.onFocus) == 'function') {
                        _opt.focus(function () {
                            options.onFocus(_opt);
                        });
                    }
                    if (typeof (options.onKeyup) == 'function') {
                        _opt.keyup(function () {
                            options.onKeyup(_opt);
                        });
                    }
                    var input = _opt.appendTo(container);                
                    if (container.closest('td[field]').attr('field') == 'ApplyDate') {
                        _opt.addClass('form-control');
                        return input.datetimepicker({
                            minView: "month", //选择日期后,不会再跳转去选择时分秒 
                            format: "yyyy-mm-dd", //选择日期后,文本框显示的日期格式 
                            language: 'zh-CN', //汉化 
                            autoclose: true
                        });
                    }else {
                        return input;
                    }
                },
                destroy: function (target) {
                    $(target).remove();
                },
                getValue: function (target) {
                    return $(target).val();
                },
                setValue: function (target, value) {
                    $(target).val(value);
                },
                resize: function (target, width) {
                    $(target)._outerWidth(width);
    
              //以下是处理图标不显示的问题   因为span 占满了单元格
                    var curField = target.closest('[field]').attr('field');
                    if (curField == "ReimbursementID" || curField == "CostCenterDisplayName" || curField == "ProductDisplayName") {
                        target.next('.textbox').css('width', width);
                        target.next().children('.textbox-text').css('width', width - 26);
                    }
                }
            }
        });    
    

      

  • 相关阅读:
    iOS判断为空或者只为空格
    一个CRM OData的性能问题分析
    什么是SAP UI5的Component-preload.js
    SAP CRM的状态管理和权限控制的集成
    如何使用SAP Intelligent Robotic Process Automation自动操作Excel
    利用S_MEMORY_INSPECTOR分析内存泄漏问题
    SAP CRM WebClient UI的搜索条件是怎么渲染出来的
    SAP CRM WebClient UI的内存清理策略分析
    SAP CRM产品主数据应用里value node和model node的转换
    如何查找SAP Fiori UI上某个字段对应的底层数据库表
  • 原文地址:https://www.cnblogs.com/yigexiaojiangshi/p/9600149.html
Copyright © 2011-2022 走看看