-
27 Aug 2012 10:14 AM #1
Answered: Fire Event from Store and receive in List view
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:
Store:Code:Ext.define 'WSI.view.EventsList', extend: 'Ext.List' xtype: 'eventslist' config: listeners: showLoading: -> alert 'showLoading in EventsList heard' @fireEvent 'showLoading', 0
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
-
Best Answer Posted by mitchellsimoens
You would have to fire the event on the store and then add a listener within the list to listen to it:
Man, IMO Coffeescript is uglyCode: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() { //.... } });
-
29 Aug 2012 4:49 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
You would have to fire the event on the store and then add a listener within the list to listen to it:
Man, IMO Coffeescript is uglyCode: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() { //.... } });
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
29 Aug 2012 8:28 AM #3
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.


Reply With Quote