Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store load before main Application ViewPort load

Tags:

extjs

extjs4

I'm running into a problem I have a store that I need to load before my Applications ViewPort is called. But when I have

autoCreateViewPort : true

My store is load after the ViewPort which won't work. I need to load the current user Model or Store before my applications ViewPort is rendered. Since my ViewPort loads panels the uses data from the Store. Any ideas on show I can make sure the store loads before the application ViewPort is created and displayed?

like image 667
b3labs Avatar asked Jan 21 '13 15:01

b3labs


1 Answers

You can insert a Ext.onReady block and within that

  • create the store
  • create a function and build your Ext.application within that function
  • attach a listener to the store's load event, with the option { single: true } and the function above as the callback

I never tested it but that should work.

Another (and recommend) option is to use your own viewport and load the store within that. There you can track the load operation the same way.

like image 177
sra Avatar answered Oct 31 '22 01:10

sra