【问题标题】:Does Extjs Combobox work with store filters?Extjs Combobox 是否与商店过滤器一起使用?
【发布时间】:2013-06-30 04:05:39
【问题描述】:

我想问一下 extjs 组合框是否使用过滤存储。我有一张不同类型的业务表(所以它有一个“类型”字段)。我有一个包含多个组合框的视图,我希望这些组合框适用于使用相同模型但具有不同过滤器的商店。所以当我让它们工作时,它不起作用。

这是过滤后的商店之一:

Ext.define('myapp.store.ListaAerolineas', {
extend: 'Ext.data.Store',

requires: [
    'myapp.model.Empresa'
],

constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
    me.callParent([Ext.apply({
        autoLoad: true,
        autoSync: true,
        model: 'myapp.model.Empresa',
        storeId: 'MyJsonPStore',
        proxy: {
            type: 'jsonp',
            url: 'http://myapp.localhost/empresa/listar/',
            reader: {
                type: 'json',
                root: 'listaempresa'
            }
        },
        filters: {
            property: 'IdTipo',
            value: 5
        }
    }, cfg)]);
}
}); 

这是模型:

Ext.define('myapp.model.Empresa', {
extend: 'Ext.data.Model',

idProperty: 'Id',

fields: [
    {
        name: 'Id',
        type: 'int'
    },
    {
        name: 'Nombre',
        type: 'string'
    },
    {
        name: 'Direccion',
        type: 'string'
    },
    {
        name: 'Telefono',
        type: 'string'
    },
    {
        name: 'Contacto',
        type: 'string'
    },
    {
        name: 'Celular',
        type: 'string'
    },
    {
        name: 'TipoEmpresa',
        type: 'string'
    },
    {
        name: 'Estado',
        type: 'string'
    },
    {
        name: 'FechaCreacion',
        type: 'date'
    },
    {
        name: 'IdTipo',
        type: 'int'
    },
    {
        name: 'IdEstado',
        type: 'int'
    }
]
});

最后这是我的组合框的网格列定义:

{
    xtype: 'gridcolumn',
    dataIndex: 'Aerolinea',
    text: 'Aerolinea',
    editor: {
    xtype: 'combobox',
    id: 'cmbGridListaEmbarquesAerolinea',
    store: 'ListaAerolineas'
}

所以,我必须做些什么?提前谢谢你...

【问题讨论】:

    标签: extjs filter combobox grid store


    【解决方案1】:

    您使用的是哪个版本的 ExtJ?但通常组合框将仅显示在商店中过滤的记录。所以,回答你的问题 - 是的,它应该可以工作。

    【讨论】:

      猜你喜欢
      • 2017-11-19
      • 2012-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-30
      • 1970-01-01
      • 2013-06-20
      • 1970-01-01
      相关资源
      最近更新 更多