|
Hi Michael,
I think the answer to your
question is as simple as calling the unregisterView() method on
the correct ViewHelper when you are destroying that view all together. Givethat
a try and let us know.
Jimmy
Gianninas
Software Developer -
Optimal Payments
Inc.
From: Michael Herron [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 8:40 AM To: [email protected] Subject: [flexcoders] Cairngorm view helpers and dynamic loading of content Hi all Currently, I have a frameworkwhere
separate “modules” are loaded in to a central panel using the createChild
method. The reason for using this method as opposed to a view stack for example
is the amount of these “modules” that I could potentially have is huge and it
seems easier/cleaner to load the modules when required. And also, correct me if
im wrong, but if a view stack was used, would each module not be loaded upon
first navigating to it and then be retained in
memory? When the user first selects amenu
option and the required module is loaded, all works fine. The user may
then navigate to another module, whereupon the initial module is destroyed using
the destroyAllChildren method and the new module loaded. The problem occursif
the user then tries to return to the original module. The module will attempt to
register its view helper which will in turn cause the view locator to throwan
error, as the view name has already been registered in the array of view helpers
- even though the view and view helper where destroyed when the new module was
loaded. This is also problem for reusable components that are being made use of
inside the modules. To confirm that this was the problem, I commented out the view locators error checking and all worked fine.
The way I see it, the only solutions are: ·
Use a view stack and switch the
selectedIndex rather than using createChild/destroyChild – perhaps this should
have been the correct design choice used in the first place? Using this method
the components problem is also solved as the view can be registered throughaction script with the “view already exists” error being caught, and just
reassigning the view attribute of the existing view helper to point to the existing instance of the component. ·
Add a forceRegister method tothe
view locator that will not perform the check for an existing view, write myown
view helper class that will override the set name method and call this method.
This method is obviously not ideal. Cairngorm is a solid framework and things
like existing view helper checking exist for a
reason. Any
thoughts/suggestions? Cheers, Mike
Herron
|
- Design point: View Helpers vs. data binding Dimitrios Gianninas
- Design point: View Helpers vs. data binding Joe Berkovitz
- RE: [flexcoders] Design point: View Helpers v... Steven Webster
- Re: [flexcoders] Design point: View Helpe... Joe Berkovitz
- RE: [flexcoders] Cairngorm view helpers and dynam... Michael Herron
- RE: [flexcoders] Cairngorm view helpers and dynam... Steven Webster

