PDA

View Full Version : Should I dynamically instanciate a controller for a window dynamically created? How?



Fire-Dragon-DoL
22 Dec 2011, 8:30 PM
This is a desktop-like application (single page), with icons, taskbar and windows.

I'm asking this because I really don't know where I should handle events of my dynamically created window.

When someone clicks on a desktop icon, the window (if it doesn't exist) will be dynamically created. Should I create a controller when creating the window and hook to it? If yes, how?

Here you can read different approaches I've thought about:


Create a controller that will instanciate the Window (as its view), I will handle everything there
Create the window only and hook everything in my taskbar controller (which is where the window is created). In this case, the Taskbar controller will become very big.
Pre-create all window controllers and eventually windows too and hide them (when page is ready). Then just show/hide them, so I will have "static" references to all controllers with getController in Application

Which approach should I use?

Fire-Dragon-DoL
23 Dec 2011, 6:43 AM
Is possible to have a human readable version of extjs 4 desktop example? Because that it's compressed and I'm having really hard times in reading it.

Fire-Dragon-DoL
24 Dec 2011, 8:00 PM
I solved by myself by preallocating controller in Application object. Then I dynamically instanciate views and I can access those through refs in my controller.

skirtle
24 Dec 2011, 8:32 PM
Is possible to have a human readable version of extjs 4 desktop example? Because that it's compressed and I'm having really hard times in reading it.

That example comes with the unminified source code and a build file.

Fire-Dragon-DoL
24 Dec 2011, 8:34 PM
I were talking about the online examples, I'll watch in local examples so, thanks.