Extjs Combobox可以使用商店过滤器吗?

时间:2013-07-02 17:00:16

标签: extjs filter combobox grid store

我想问你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'
}

所以,我必须做任何事情?提前谢谢你......

1 个答案:

答案 0 :(得分:0)

您使用的是什么版本的ExtJ?但通常,组合框只显示在商店中过滤的记录。所以,回答你的问题 - 是的,它应该有用。