-
27 Oct 2011 12:12 PM #1Ext JS Premium Member
- Join Date
- Jun 2011
- Location
- Ottawa, Ontario, Canada
- Posts
- 123
- Vote Rating
- 1
- Answers
- 3
Answered: How to find out from the Grid that Store is loaded
Answered: How to find out from the Grid that Store is loaded
Hi
Store.load() is asynchronous. We need to do some actions within Grid after store is loaded.
Is there any ways for Grid to know that Store is loaded?
Thanks
-
Best Answer Posted by mitchellsimoens
In the Grid, listen for the Store's load event. If you need to do something on the Store that you need access to the Grid, then in that load listener, pass the instance of the Grid.
-
27 Oct 2011 1:33 PM #2
Have you tried the viewready event?
Have you tried the viewready event?
Have you tried listening for the "viewready" event and then performing your actions? I believe that this event is fired late enough that there is data in the store. They state in the documentation that this is the event you would listen for if you were wanting to select a default row. Here is the link to the viewready documentation for the grid panel: http://docs.sencha.com/ext-js/4-0/#!...vent-viewready
-
27 Oct 2011 9:12 PM #3
The actions which you want to perform after loading of store can be called in the 'load' event of store (you can define this in the listeners of store). For more details - http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.Store-event-load
One other way of checking if the store has loaded or not is by using store.isLoading() - http://docs.sencha.com/ext-js/4-0/#!...thod-isLoading
-
28 Oct 2011 6:17 AM #4Ext JS Premium Member
- Join Date
- Jun 2011
- Location
- Ottawa, Ontario, Canada
- Posts
- 123
- Vote Rating
- 1
- Answers
- 3
-
28 Oct 2011 6:44 AM #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
In the Grid, listen for the Store's load event. If you need to do something on the Store that you need access to the Grid, then in that load listener, pass the instance of the Grid.
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.
-
28 Oct 2011 6:48 AM #6Ext JS Premium Member
- Join Date
- Jun 2011
- Location
- Ottawa, Ontario, Canada
- Posts
- 123
- Vote Rating
- 1
- Answers
- 3
Just to clarify, 'load' event from store bubbles up to 'grid'? And would you please give quick code example for 'then in that load listener, pass the instance of the Grid.' ?
Thanks
Paul
-
28 Oct 2011 7:04 AM #7
Code:Ext.create('Ext.grid.Panel', { initComponent: function() { this.callParent(); this.mon(this.getStore(), 'load', this.storeLoaded, this); }, storeLoaded: function() { ... } });Last edited by skirtle; 28 Oct 2011 at 7:06 AM. Reason: Use mon instead of on
-
28 Oct 2011 7:14 AM #8Ext JS Premium Member
- Join Date
- Jun 2011
- Location
- Ottawa, Ontario, Canada
- Posts
- 123
- Vote Rating
- 1
- Answers
- 3
Can't mark two answers as best but thank you very much both of you

Paul


Reply With Quote