zoukankan      html  css  js  c++  java
  • 解决Ext4.2.3中propertyGrid修改后点击排序报错

    Ext4.2.3中PropertyGrid修改后点击排序报错,具体错误信息如下:

     
    一开始还怀疑是自己哪里配置错了,各种尝试结果还是一样。查遍百度和谷歌,无果,只有一篇帖子说是4.2.4修正了。还是自己动手吧,自己动手丰衣足食。
    点开报错地方(如下图所示),原来是me.field.column没有定义。
     
    然后继续找,找啊找啊找到Ext.grid.property.GridgetCellEditor方法。此方法有参数column,可在方法体内,column就没有被用到过,于是就感觉问题出在这里。
    经过实践,讲此方法修改如下,此bug就解决了。
     
        getCellEditor : function(record, column) {
            var me = this,
                propName = record.get(me.nameField),
                val = record.get(me.valueField),
                editor = me.getConfig(propName, 'editor'),
                type = me.getConfig(propName, 'type'),
                editors = me.editors;
            
            if (editor) {
                if (!(editor instanceof Ext.grid.CellEditor)) {
                    if (!(editor instanceof Ext.form.field.Base)) {
                        editor = Ext.ComponentManager.create(editor, 'textfield');
                    }
                    editor = me.setConfig(propName, 'editor', new Ext.grid.CellEditor({ field: Ext.apply(editor,{column:column}) }));
                }
            } else if (type) {
                switch (type) {
    
    
                    case 'date':
                        editor = new Ext.grid.CellEditor({ field: new Ext.form.field.Date({column: column,selectOnFocus: true})});
                        break;
                    case 'number':
                        editor = new Ext.grid.CellEditor({field: new Ext.form.field.Number({column: column,selectOnFocus: true})});
                        break;
                    case 'boolean':
                        editor = new Ext.grid.CellEditor({field: new Ext.form.field.ComboBox({column: column,
                            editable: false,
                            store: [[ true, me.headerCt.trueText ], [false, me.headerCt.falseText ]]
                        })});
                        break;
                    default:
                        editor = new Ext.grid.CellEditor({field: new Ext.form.field.Text({column: column,selectOnFocus: true})});
                }
            } else if (Ext.isDate(val)) {
                editor = new Ext.grid.CellEditor({ field: new Ext.form.field.Date({column: column,selectOnFocus: true})});
            } else if (Ext.isNumber(val)) {
                editor = new Ext.grid.CellEditor({field: new Ext.form.field.Number({column: column,selectOnFocus: true})});
            } else if (Ext.isBoolean(val)) {
                editor = new Ext.grid.CellEditor({field: new Ext.form.field.ComboBox({column: column,
                    editable: false,
                    store: [[ true, me.headerCt.trueText ], [false, me.headerCt.falseText ]]
                })});
            } else {
                editor = new Ext.grid.CellEditor({field: new Ext.form.field.Text({column: column,selectOnFocus: true})});
            }
            
            editor.editorId = propName;
            return editor;
        }
         
  • 相关阅读:
    日志框架之Slf4j整合Logback
    使用SLF4J和Logback
    Java日志框架SLF4J和log4j以及logback的联系和区别
    docker部署apollo
    mysql8.0设置忽略大小写后无法启动
    将项目迁移到kubernetes平台是怎样实现的
    kubectl port-forward
    linux服务器安全配置最详解
    CentOS7.3下部署Rsyslog+LogAnalyzer+MySQL中央日志服务器
    统计linux 下当前socket 的fd数量
  • 原文地址:https://www.cnblogs.com/erduyang/p/4576021.html
Copyright © 2011-2022 走看看