【问题标题】:Extjs Combo Box Not UpdatingExtjs 组合框未更新
【发布时间】:2013-04-16 01:16:25
【问题描述】:

我在 ExtJS 4.2 中有一个组合框,我最初使用一个包含 0 个项目的商店创建它。后来我计算了一堆东西并更新组合框,在与组合框关联的商店上使用 loadRawData。不知何故,商店更新了,我已经通过代码确认,但组合框没有看到任何更新。

这是创建 extjs 内容的代码和相关 jsfiddle 的链接:

Ext.define('ItemTemplateModel', {
    extend: 'Ext.data.Model',
    fields: [
        { name: 'id', type: 'int' },
        { name: 'imageUri', type: 'string' },
        { name: 'name', type: 'string' }
    ]
});

var itemTemplateStore = Ext.create('Ext.data.Store', {
    model: 'ItemTemplateModel',
    autoLoad: false,
    proxy: {
        type: 'memory',
        reader: {
            type: 'json',
            root: 'entries'
        }
    }
});

var comboBox = Ext.create('Ext.form.field.ComboBox', {
    store: itemTemplateStore,
    fieldLabel: 'Item Template',
    name: 'template',
    displayField: 'name',
    valueField: 'id',
    editable: false,
    typeAhead: false,
    triggerAction: 'all'
});

http://jsfiddle.net/qqHYp/

【问题讨论】:

    标签: javascript extjs extjs4


    【解决方案1】:

    你使用内存代理 - 需要添加

    queryMode: 'local',
    

    在组合配置中: http://jsfiddle.net/qqHYp/4/

    【讨论】:

    • 哇,我不敢相信这不是商店属性,而且组合框是唯一具有该属性的项目。似乎 ExtJS 真的在这里丢球了。
    • 刚刚也遇到过这个问题,我从没想过在尝试本地 store.loadRawData() 时需要这样做
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-08-19
    • 2013-01-11
    • 1970-01-01
    • 2012-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多