tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/188-adding-removing-viewsRobotlegs: Discussion 2018-10-18T16:35:13Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/18867802010-06-08T08:53:07Z2010-06-08T08:53:07ZAdding / Removing views<div><p>Your most likely path to success is by mediating a container
view. This might be your contextView, but some container that you
can easily add/remove these children from. You would then handle
the event from your service in the mediator instead of the command.
A command is generally a poor place to handle display list
management.</p></div>Joel Hookstag:robotlegs.tenderapp.com,2009-10-18:Comment/18867802010-06-08T09:07:17Z2010-06-08T09:07:18ZAdding / Removing views<div><p>Thanks for the quick reply.</p>
<p>So, if my service is dispatching an event i.e. ASSETS_LOADED;
should that be handled in my PreloaderMediator then? If so then
should I be using onRemove()?</p></div>Paras Shethtag:robotlegs.tenderapp.com,2009-10-18:Comment/18867802010-06-08T09:25:49Z2010-06-08T09:25:52ZAdding / Removing views<div><p>sorry.. also.. when does onRemove() in the mediator get
called?</p></div>Paras Shethtag:robotlegs.tenderapp.com,2009-10-18:Comment/18867802010-07-13T13:55:32Z2010-07-13T13:55:36ZAdding / Removing views<div><p>Would like to hear an answer too :)</p></div>Mark A.tag:robotlegs.tenderapp.com,2009-10-18:Comment/18867802010-07-13T14:15:44Z2010-07-13T14:15:46ZAdding / Removing views<div><p>unfortunately, i couldn't find a way to remove views
gracefully.</p>
<p>I just dispatched an event and removed the view! it wasn't too
bad solution for my project though.</p></div>Paras Shethtag:robotlegs.tenderapp.com,2009-10-18:Comment/18867802010-07-13T16:02:43Z2010-07-13T16:02:43ZAdding / Removing views<div><p>It's perfectly valid to dispatch an Event that Mediators can
catch and respond to, instructing the view to remove itself. With
automatic mediation simply removing the view component from the
stage will cause the Mediator to be unregistered and removed (and
this is when the onRemove hook would run).</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/18867802010-07-14T11:44:46Z2010-07-14T11:44:47ZAdding / Removing views<div><p>Thanks Shaun.</p>
<p>Now I feel better!</p></div>Paras Sheth