Results 1 to 3 of 3

Thread: Fire Event from Store and receive in List view

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    52
    Answers
    3
    Vote Rating
    0
      0  

    Default Answered: Fire Event from Store and receive in List view

    How do I get that alert to fire in the List view upon store loading?

    Coffeescript:

    List:
    Code:
    Ext.define 'WSI.view.EventsList',
      extend: 'Ext.List'
      xtype: 'eventslist'
      config:
        listeners:
          showLoading: ->
            alert 'showLoading in EventsList heard'
            @fireEvent 'showLoading', 0
    Store:
    Code:
    Ext.define 'WSI.store.Events',
      extend: 'Ext.data.Store'
      xtype: 'eventsstore'
      config:
        model: 'WSI.model.Event'
        autoLoad: false
        pageSize: 15
        listeners:
          beforeload: ->
            @fireEvent 'showLoading', 0
          load: ->
            @fireEvent 'hideLoading', 0

  2. You would have to fire the event on the store and then add a listener within the list to listen to it:

    Code:
    Ext.define('MyList', {
        extend : 'Ext.dataview.List',
        xtype  : 'my-list',
    
        //...
    
        updateStore: function(newStore, oldStore) {
            if (oldStore) {
                oldStore.un('storeLoading', 'onStoreLoading', this);
            }
    
            if (newStore) {
                newStore.on('storeLoading', 'onStoreLoading', this);
            }
        },
    
        onStoreLoading : function() {
            //....
        }
    });
    Man, IMO Coffeescript is ugly

  3. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,060
    Answers
    3976
    Vote Rating
    1389
      0  

    Default

    You would have to fire the event on the store and then add a listener within the list to listen to it:

    Code:
    Ext.define('MyList', {
        extend : 'Ext.dataview.List',
        xtype  : 'my-list',
    
        //...
    
        updateStore: function(newStore, oldStore) {
            if (oldStore) {
                oldStore.un('storeLoading', 'onStoreLoading', this);
            }
    
            if (newStore) {
                newStore.on('storeLoading', 'onStoreLoading', this);
            }
        },
    
        onStoreLoading : function() {
            //....
        }
    });
    Man, IMO Coffeescript is ugly
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    52
    Answers
    3
    Vote Rating
    0
      0  

    Default

    Thanks!

    Funny, I thought coffeescript looked so nice and it saves so many commas when using Sencha Touch. It can be cluttered though because if you space it out too much then it can get confusing.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •