2012-09-24 28 views
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); 
}, 
... 
} 

回答

2

试试这个代码

Ext.getStore('storeId') 

它会给你店里的对象

+0

但如何我在哪里定义'storeId'? xtype不会按我的方式做。 –

+0

soterId是商店的配置,因此您可以在商店中定义storeId:'testStore' –

+0

thx。我发现商店的名字也会这样。所以如果商店被称为Contacts.js,你可以这样做:Ext.getStore(“Contacts”); –

相关问题