设置配置不是功能

时间:2018-10-22 09:56:13

标签: javascript store propertygrid

我有一些商店,它是数据。在面板上,它看起来如何“ fieldName”和文本字段(与调用的形式有所不同)。例如,在一种形式上显示“名称文档”和字段,在另一种形式上显示:销售日期和日期字段。数据是动态形成的

这是商店:

tableTempStore = new Ext.data.JsonStore({
    url: objectUrlAddress,
    baseParams: {
        'objectID': objectID
    },
    root: 'Fields',
    fields: [{
        name: 'Type',
        type: 'int'
    }, {
        name: 'Value'
    }, {
        name: 'IsRequired',
        type: 'bool'
    }, {
        name: 'Identifier'
    }, {
        name: 'Data'
    }],
    listeners: {
        load: function(obj, records) {
            Ext.each(records, function(rec) {

                var item = null;
                switch (rec.get('Type')) {
                    case 0:
                        item = new Ext.form.NumberField();
                        item.id = rec.get('Identifier');
                        item.fieldLabel = rec.get('Hint');
                        var isRequired = rec.get('IsRequired');
                        item.anchor = '100%';
                        item.allowBlank = !isRequired;
                        item.disabled = editDisabled;
                        item.value = rec.get('Data');
                        break;
                    case 1:
                        item = new Ext.form.NumberField();
                        item.id = rec.get('Identifier');
                        item.fieldLabel = rec.get('Hint');
                        var isRequired = rec.get('IsRequired');
                        item.anchor = '100%';
                        item.allowBlank = !isRequired;
                        item.allowDecimals = true;
                        item.disabled = editDisabled;
                        item.value = rec.get('Data');
                        break;
                }
                if (item != null) {
                    grid.add(item);
                    columnsTable = item.__proto__.constructor.xtype;
                        source[item.fieldLabel] = '';
                        grid.setSource(source);
                        var cm = grid.getColumnModel();
                        var valCol = cm.getColumnAt(1);
                        if (columnsTable=='textfield')
                        {
                            valCol.setConfig({
                                header: 'Поле', 
                                id:'name',
                               editor:  {xtype: 'textfield'}
                            });
                        }
                        else if (columnsTable == 'combo')
                        {
                            valCol.setConfig({
                               xtype: new Ext.grid.GridEditor(new Ext.form.ComboBox()),
                               allowBlank: false,
                            });
                        }
                        else if (columnsTable == 'datefield')
                        {
                            valCol.setConfig({
                               xtype: new Ext.grid.GridEditor(new Ext.form.DateField()),
                               allowBlank: false,
                            });
                        }
                }
            });
            grid.setSource(source);
        }
    }
});

但是我有一些错误:setConfig不是函数。为什么,如果他在其他活动中工作。

这是网格:

grid = new Ext.grid.PropertyGrid({
        title: 'Properties Grid',
        id: 'propGrid',
        customEditors: 
        {
            tableValue: new Ext.grid.GridEditor(new Ext.form.ComboBox())
        },
        autoFill: true,
        autoHeight: true,
        width: 600
        });

0 个答案:

没有答案