Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
extJs-带组合框单元格编辑的GridPanel_Extjs_Combobox_Extjs4_Gridpanel - Fatal编程技术网

extJs-带组合框单元格编辑的GridPanel

extJs-带组合框单元格编辑的GridPanel,extjs,combobox,extjs4,gridpanel,Extjs,Combobox,Extjs4,Gridpanel,我有一个从本地商店填充的网格面板。我添加了组合框来编辑类型单元格。我希望从远程源填充我的组合框。但我不能让它加载任何数据。这是我的密码: Ext.define('System.view.MainTab.NewConnection.Contacts'{ 扩展:“Ext.grid.Panel”, 别名:“widget.newConnectionContactsPanel” requires: [ 'Ext.grid.View', 'Ext.grid.column.Column',

我有一个从本地商店填充的网格面板。我添加了组合框来编辑
类型
单元格。我希望从远程源填充我的组合框。但我不能让它加载任何数据。这是我的密码:

Ext.define('System.view.MainTab.NewConnection.Contacts'{ 扩展:“Ext.grid.Panel”, 别名:“widget.newConnectionContactsPanel”

requires: [
    'Ext.grid.View',
    'Ext.grid.column.Column',
    'Ext.form.field.ComboBox',
    'Ext.toolbar.Toolbar',
    'Ext.toolbar.Fill',
    'Ext.button.Button',
    'Ext.grid.plugin.RowEditing'
],

height: 250,
width: 400,
itemId: 'contactsGridPanel',
title: 'My Grid Panel',

initComponent: function() {
    var records = [];
    var store = new Ext.data.ArrayStore({
        fields: [
            {name: 'type'},
            {name: 'value'}
        ]
    });

    store.loadData(records);
    var me = this;

    Ext.applyIf(me, {
        columns: [
            {
                dataIndex: 'type',
                xtype: 'gridcolumn',
                text: 'Type',
                flex: 1,
                editor: {
                    xtype: 'combobox',
                    displayField: 'neme',
                    valueField: 'id',
                    queryMmode: 'remote',
                    store: new Ext.data.JsonStore({
                        proxy: {
                            type: 'ajax',
                            url: '/ws/rest/contacts/getKeywords.json?keywordType=CONTACTS',
                            reader: {
                                type: 'json',
                                root: 'data',
                                idProperty: 'id'
                            }
                        },
                        autoLoad: true,
                        fields: [
                            {type: 'integer', name: 'id'},
                            {type: 'string', name: 'name'}
                        ]
                    })

                }
            },
            {
                dataIndex: 'value',
                xtype: 'gridcolumn',
                text: 'Value',
                flex: 1,
                editor: {
                    xtype: 'textfield'
                }
            }
        ],
        dockedItems: [
            {
                xtype: 'toolbar',
                dock: 'bottom',
                items: [
                    {
                        xtype: 'tbfill'
                    },
                    {
                        xtype: 'button',
                        itemId: 'removeBtn',
                        text: 'Remove'
                    },
                    {
                        xtype: 'button',
                        itemId: 'addBtn',
                        text: 'Add',
                        listeners: {
                            click: function (button, e, eOpts) {
                                var grid = button.up('#contactsGridPanel');
                                var store = grid.getStore();

                                var rowEditing = grid.getPlugin('rowediting');
                                rowEditing.cancelEdit();
                                var record = store.add({})[0];

                                rowEditing.startEdit(record, 0);
                            }
                        }
                    }
                ]
            }
        ],
        plugins: [
            Ext.create('Ext.grid.plugin.RowEditing', {
                pluginId: 'rowediting',
                listeners: {
                    edit: function() {

                    }
                }
            })
        ]
    });

    me.callParent(arguments);
}
}))

以下是我从服务器得到的json响应:

{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Fax"
    },
    {
      "id": 2,
      "name": "Home page"
    }
  ]
}

不能让这一切都成功。组合框为空。我做错了什么?

最有可能的是您的
显示字段
配置中有输入错误


作为旁注,您应该真正说出您所做的调试类型。说你“做不到”并没有真正的帮助。请求是否命中服务器?商店里有数据吗?提及您所做的事情将有助于有人回答您。

您应该从远程源获取列值。尝试添加映射属性

autoLoad: true,
fields: [
   {type: 'integer', name: 'id', **mapping:'id'**},
   {type: 'string', name: 'name', **mapping :'name'**}
]

是的,再次检查代码,发现两个拼写错误:-)愚蠢的我:-)无论如何,谢谢!