2014-07-11 154 views
0

創建存儲時添加extraParams我有我的ExtJS 4.2.1應用在我的觀點:ExtJS的商店鑑於

xtype: 'combobox', 
    itemId: 'cboEmployeeNumber', 
    width: 180, 
    store: Ext.create('App.store.employee.EmployeeCombo', { 
     // here I want to set extraParams maybe like 
     // proxy.extraParams:{ employerId:0} 
    }), 

我可以做我的控制器內:

onEmployeeBeforeQuery: function(queryPlan, eOpts) { 
     var me = this, 
      employerId = me.getEditRequest().down('#cboEmployer').getValue(), 
      store = me.getEditRequest().down('#cboEmployee').getStore() 

     store.getProxy().extraParams = { 
      employerId: employerId 
     }; 
    }, 

卻怎麼也創建商店時,我認爲這是我的看法?

謝謝。

回答

0

創建商店時,您可以配置代理:

store: Ext.create('App.store.employee.EmployeeCombo', { 
    proxy:{ 
     type:'ajax', 
     url:'.....', 
     extraParams:{ 
      // your extra params here 
     } 
    } 
})