PDA

View Full Version : Configuring stores via controller 'stores' config.



k_cire0426
24 Nov 2013, 11:55 PM
Why is it necessary to configure the store from 'stores' config of controller to make it usable? If I did not do that there was an error 'cannot call method 'on' of undefined'. Can't we just require it from view or from controller using 'requires'? How do i use the store from other/app or outside the folder of current app?

troseberry
25 Nov 2013, 7:22 AM
If I remember correctly the stores listed in the stores config not only load the required class but creates a getter for that store. When that getter is ran it will check if it has been created and if not create a new instance of that store.

If you dont load it that way then you just need to require it and then do Ext.create of the store class

dawesi
25 Nov 2013, 7:28 AM
It's not necessary. As stores are defined and created when the app loads, if you want your store to be created later, then you can use :




Ext.create('MyApp.store.MyStore',{...config...});