1
我有一個處理onLogin()的獲取請求成功登錄後稱爲控制器:如何獲取控制器中的存儲以將數據綁定到視圖?
Ext.define('AddressBook.controller.Application', {
extend: 'Ext.app.Controller',
...
onLogin: function(form, record) {
var editButton = this.getEditButton();
if (!this.showContact) {
this.showContact = Ext.create('AddressBook.view.contact.Show');
}
//how to get this store?
var store = getContactsStore();
//how to get the data in the store or should I get the model?
this.showContacts.updateDataProvider(store.array);
// Push the show contact view into the navigation view
this.getMain().push(this.showContact);
},
...
}
但如何我在哪裏定義'storeId'? xtype不會按我的方式做。 –
soterId是商店的配置,因此您可以在商店中定義storeId:'testStore' –
thx。我發現商店的名字也會這樣。所以如果商店被稱爲Contacts.js,你可以這樣做:Ext.getStore(「Contacts」); –