2013-07-02 37 views
1

我想問你,如果extjs組合框使用過濾商店。我有一個不同類型的業務表(所以它有一個「類型」字段)。我有一個與多個組合框的視圖,我希望那些使用相同模型,但使用不同過濾器的商店。所以當我讓他們工作時,它不起作用。Extjs Combobox是否適用於商店過濾器?

這是過濾的商店之一:

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' 
} 

所以,我必須做任何事情?預先感謝您...

回答

0

您使用的是什麼版本的ExtJs?但一般情況下,組合框只會顯示在商店中過濾的記錄。所以,要回答你的問題 - 是的,它應該工作。

+0

嗨@sha ...我正在使用extjs 4.2.1 ...我將再次檢查... – sonseiya