我照着那个移花接木EXT控件写的一个案例,点击单元格为什么没有出现COMBO下拉框?大家请帮忙看看!Ext.ns('Ext.ux.grid');
Ext.ux.grid.MyColumnModel = function (grid, store, column) {
    this.grid = grid;
    this.store = store;
    var gender = [['0100', '男'], ['0101', '女']];
    var department = [['0200', '文学院'], ['0201', '医学院']];
    var title = [['0300', '助教'], ['0301', '教授']];
    var genderCombo = new Ext.form.ComboBox({
        store: new Ext.data.ArrayStore({
            fields: ['value', 'text'],
            data: gender
        }),
        emptyText: '请输入',
        mode: 'local',
        triggerAction: 'all',
        valueField: 'value',
        displayField: 'text',
        readOnly: true
    });
    var departmentCombo = new Ext.form.ComboBox({
        store: new Ext.data.ArrayStore({
            fields: ['value', 'text'],
            data: department
        }),
        emptyText: '请输入',
        mode: 'local',
        triggerAction: 'all',
        valueField: 'value',
        displayField: 'text',
        readOnly: true
    });
    var titleCombo = new Ext.form.ComboBox({
        store: new Ext.data.ArrayStore({
            fields: ['value', 'text'],
            data: title
        }),
        emptyText: '请输入',
        mode: 'local',
        triggerAction: 'all',
        valueField: 'value',
        displayField: 'text',
        readOnly: true
    });
    this.customEditors = {
        'GENDER': new Ext.grid.GridEditor(genderCombo),
        'DEPARTMENT': new Ext.grid.GridEditor(departmentCombo),
        'TITLE': new Ext.grid.GridEditor(titleCombo),
        'AGE': new Ext.grid.GridEditor(new Ext.form.NumberField({ selectOnFocus: true, style: 'text-align:left;' })),
        'PAPER': new Ext.grid.GridEditor(new Ext.form.NumberField({ selectOnFocus: true, style: 'text-align:left;' }))
    };
    Ext.ux.grid.MyColumnModel.superclass.constructor.call(this, column);
};
Ext.extend(Ext.ux.grid.MyColumnModel, Ext.grid.ColumnModel, {    getCellEditor: function (colIndex, rowIndex) {
        var p = this.store.getAt(rowIndex);
        n = p.data.attrName;
        if (colIndex == 4) {
            if (this.customEditors[n]) {
                return this.customEditors[n];
            } else {
                var ed = new Ext.grid.GridEditor(new Ext.form.TextField({
                    selectOnFocus: true
                }));
                return ed;
            }
        }
        return this.config[colIndex].editor;
    }
});
Ext.onReady(function () {
    var comboData1 = [['AGE', '年龄'], ['DEPARTMENT', '院系']];
    var comboData2 = [['>', '大于'], ['!=', '不等于']];
    var combo1 = new Ext.form.ComboBox({
        id: 'attrCombo',
        store: new Ext.data.ArrayStore({
            fields: ['value', 'text'],
            data: comboData1
        }),
        emptyText: '请选择',
        mode: 'local',
        triggerAction: 'all',
        valueField: 'value',
        displayField: 'text',
        readOnly: true
    });
    var combo2 = new Ext.form.ComboBox({
        id: 'operatorCombo',
        store: new Ext.data.ArrayStore({
            fields: ['value', 'text'],
            data: comboData2
        }),
        emptyText: '请选择',
        mode: 'local',
        triggerAction: 'all',
        valueField: 'value',
        displayField: 'text',
        readOnly: true
    });    var conditiondata = [];
    var gStore = new Ext.data.ArrayStore({
        fields: [
{ name: 'fundConditionId' },
{ name: 'attrName' },
{ name: 'operator' },
{ name: 'propertyValue' }
],
        data: conditiondata
    });
    var rec = new Ext.data.Record({ attrName: 'AGE', operator: '>', propertyValue: '' });
    gStore.add(rec);
    var sm = new Ext.grid.CheckboxSelectionModel({ handleMouseDown: Ext.emptyFn });
    var column = [sm,
{
    header: '条件ID',
    dataIndex: 'fundConditionId',
    hidden: true
}, {
    header: '属性名称',
    dataIndex: 'attrName',
    editor: new Ext.grid.GridEditor(combo1)
},
{
    header: '操作符',
    dataIndex: 'operator',
    editor: new Ext.grid.GridEditor(combo2)
},
{
    header: '属性值',
    dataIndex: 'propertyValue',
    editor: new Ext.grid.GridEditor(new Ext.form.TextField({ selectOnFocus: true }))
}];
    var fundConditionGrid = new Ext.grid.EditorGridPanel({
        name: 'fundCondition',
        id: 'fundCondition',
        store: gStore,
        cm: new Ext.ux.grid.MyColumnModel(this, gStore, column),
        sm: sm,
        tbar: ['-', { text: '添加条件' }, '-', { text: '删除条件' }, '-'],
        collapsible: true,
        animCollapse: false,
        title: '助研基金申请条件',
        width: 350,
        height: 300,
        clicksToEdit: 1,
        renderTo: 'ext'
    });
});

解决方案 »

  1.   

    刚才调试了一下,发现ComboBox里面如果设置readOnly: true,则下拉按钮不会出现,去掉就会出现COMBOBOX,然后我测试EXT3.2中其他的例子,都是这样,移花接木用的估计是EXT2.0的代码!EXT2.0应该是正确的。为什么EXT3.2就变了呢?
      

  2.   

    刚才查了一下EXT3.2的手册,发现设置editable:false,就可以达到EXT2.0设置readOnly: true同样的效果,但EXT3.2不能设置readOnly: true!