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;
        }
         
  • 相关阅读:
    我的vim开发环境搭建:C/C++/Go,持续更新中
    MFC的组合框(ComboBox)控件切换下拉样式
    回顾下杂乱的10月
    C++将整型数据转换成大端或小端存储顺序
    C/C++动态分配连续空间,下标越界导致的free():invalid next size问题
    O(n)空间复杂度,打印杨辉三角形的前n行
    C指针笔试题,蛋疼的多重指针运算,谭浩强的阴影
    2017滴滴出行笔试题:异或和为0的最大区间个数
    manjaro安装
    关于top命令
  • 原文地址:https://www.cnblogs.com/erduyang/p/4576021.html
Copyright © 2011-2022 走看看