PDA

View Full Version : How to have Ext.Loader to reload an already loaded view ?



joseph.piron
26 Mar 2012, 12:05 AM
Hi guys !

For a new application we are setting up here we chose to try extjs, and it's impressive (but not so easy at first :)).
Anyway, for this app, we need some kind of customizable dashboard feature and to get this we tried with a concept of view defined dashboards that user can create. And so, we'd like to be able to reload a particular view to get any new layout etc..

I am using the Loader system and tried this:
- get the view
- destroy it
- set Ext.Loader.isFileLoaded.[viewclassname] to false
- null the var
- Ext.create([viewclassname])

but the system does not reload the view from server, only recreate an instance.
Is there a way to do this ?

Thanks in advance for your support !!

mitchellsimoens
26 Mar 2012, 7:46 AM
Why are you wanting to reload a class definition?

joseph.piron
27 Mar 2012, 4:24 AM
Hmm.. because I need to.. :)
Because I want to have the possibility to let users here modify class definition and then reload them in the remote interface. Another possibility would be to create a simple view, and have a config shared, but I want to pass by the trouble to create a new interface etc..

sskow200
27 Mar 2012, 4:28 AM
Ext.Loader.syncRequire('MyApp.view.MyView');


This should reload the class definition. Or am I missing something?

joseph.piron
27 Mar 2012, 5:43 AM
Hmm it seems not to reload it if it was already loaded.. ?

sskow200
27 Mar 2012, 6:22 AM
I thought you had solved that with:



- set Ext.Loader.isFileLoaded.[viewclassname] to false


However, I do believe if the class definition exists Ext.Loader won't kick in. This is most likely because using the Ext.Loader in a production application is not advised by the Ext designers. Could you give my an example on what you mean by

"I want to have the possibility to let users here modify class definition"

It seems like if this is just user configurable options for each class, then another approach may be better, but I don't quite understand your use case.

joseph.piron
27 Mar 2012, 1:41 PM
No isLoaded doesn't do the trick neither.
But it doesn't matter, I fellback on another paragidm: config by item saved. It works :)

Thanks!