如何在Controller中获取存储以将数据绑定到View?

时间:2012-09-24 09:59:45

标签: extjs sencha-touch-2

我有一个带有处理程序onLogin()的Controller,它在成功登录请求后被调用:

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);
},
...
}

1 个答案:

答案 0 :(得分:3)

试试这段代码

Ext.getStore('storeId')

它会给你商店的对象