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;
        }
         
  • 相关阅读:
    python,selenium遇到的问题
    python环境配置
    性能测试函数
    性能测试的关注点
    环境配置
    性能监控工具使用
    linux路径
    linux权限
    自动化测试工具
    书籍
  • 原文地址:https://www.cnblogs.com/erduyang/p/4576021.html
Copyright © 2011-2022 走看看