1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    15
    Vote Rating
    1
    raye is on a distinguished road

      0  

    Default Answered: How to reference store and define control callback in controller?

    Answered: How to reference store and define control callback in controller?


    Hi ALL,
    I would like to reference a store and define handlers for it's events. Here is the case:

    Ext.define('MobileApp.controller.ContactTag', {
    extend: 'Ext.app.Controller',
    ......
    config: {
    refs: {
    storeContactTags: {
    selector: '#storeContactTag'
    }
    },
    control: {
    storeContactTags: {
    load: 'storeContactTagLoaded'
    }
    }
    }
    ....
    }

    ==============
    Ext.define('MobileApp.store.ContactTag', {
    extend: 'Ext.data.Stroe',
    config: {
    id: 'storeContactTag'
    ....
    }
    }

    The store is used for a Ext.List obj. When ContactTags performs CRUD, all relevant views (like form.Panel) should update at the same time.

    I suppose to do the definition in controller. But it doesn't work as I though. Therefore I have to specify a listener in the store (that I think it is not appropriate):

    Ext.define('MobileApp.store.ContactTag', {
    extend: 'Ext.data.Stroe',
    listeners: {
    load: function(store, records, successful, operation, eOpts) {
    ......
    }
    }
    }



    Anyone has better solutions??


  2. Store is not a component, so you can not use the refs or control to locate the Store,
    give the Store a storeId, then use Ext.getStore('storeId').load(...)

  3. #2
    Sencha User
    Join Date
    Apr 2012
    Location
    ShenZhen, China
    Posts
    52
    Answers
    11
    Vote Rating
    2
    liaoyiwu is on a distinguished road

      0  

    Default


    Store is not a component, so you can not use the refs or control to locate the Store,
    give the Store a storeId, then use Ext.getStore('storeId').load(...)

Thread Participants: 1

Tags for this Thread