?
Solved

Closing Pop Up empties my ArrayCollections

Posted on 2009-04-08
6
Medium Priority
?
287 Views
Last Modified: 2012-05-06
I have a pop up, and it holds like 3 array collections. When the page is first loaded, those array collections display data perfect. When I close it like:

close="PopUpManager.removePopUp(this);"

And then try and reopen the window. All my data is gone, and fields blank. Is it possible to keep the data contained within those ACs, or do I need to repopulate them every time the pop up is opened?

I am using PureMVC, and after I open the pop up, I do a trace, and EACH time I open it, I see the data I am looking for, but it only populates my list the first time, I open it. Every other time it's empty

trace(mx.utils.ObjectUtil.toString(manageColumns.cols));


0
Comment
Question by:hallikpapa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 5

Expert Comment

by:Fuzzy_Logic_
ID: 24100107
In pureMVC the data shouldn't be so closely coupled to the popUp. The mediator which opens the popUp should load the popUp with the data which it gets from the proxy.

So Notification triggers popUp, then send Notification to load popUp with data. Then it makes no difference when/where/how the popUp is opened.
0
 

Author Comment

by:hallikpapa
ID: 24100530
When I click the button for the pop up it calls my openPopUpWindow which is currently in the ApplicationFacade. I am trying to handle all pop ups. After openPopUpWindow method is finished, where should I tell it to populate the data? Can't do it in the facade.

I tried a onCreationComplete in the view component, but again, only works the first time the window opens.



public static function openPopUpWindow( ComponentClass:Class, MediatorClass:Class ):void
{
	var window:IFlexDisplayObject = PopUpManager.createPopUp( Application.application as Sprite, ComponentClass, true );
	ApplicationFacade.getInstance().registerMediator( new MediatorClass( window ) );
	PopUpManager.centerPopUp( window );	
	//sendNotification(ApplicationFacade.RETRIEVE_COLUMNS);
}
 
public static function closePopUpWindow( window:IFlexDisplayObject, mediatorName:String ):void
{
	PopUpManager.removePopUp( window );
	ApplicationFacade.getInstance().removeMediator( mediatorName );
}

Open in new window

0
 

Author Comment

by:hallikpapa
ID: 24100997
Maybe I need to use an itemRenderer, or makelistData? How would I use something like that?

http://livedocs.adobe.com/flex/3/langref/mx/controls/List.html#makeListData()

<mx:List id="lstColumns" 
    	dataProvider="{cols}" 
    	width="250" 
        labelField="headerText" 
        allowMultipleSelection="true"
        itemClick="_sendEvent(COLUMN_SELECT)"/>   

Open in new window

0
[Video] Create a Disruption-Free Workspace

Open offices have their challenges. And Sometimes, it's even hard to work at work. It's time to reclaim your office and create a disruption-free workspace. With the MB 660, you can:

-Increase Concentration
-Improve well-being
-Boost Productivity

 
LVL 5

Accepted Solution

by:
Fuzzy_Logic_ earned 2000 total points
ID: 24103031
I've built a sample for you to look at, might help explain or just make things even more confusing!

Its a tad overkill, but in my opinion how PureMVC should be used to seperate everything.

http://www.ff-ant.co.uk/PopUpWindow_PureMVC_Sample/MyApplication.html

right click for 'View Source'

in the src.view.mediators.PopUpMediator you will find the function popUpCreation_Complete. This is where the PopUp window would get its data and load it into the PopUp from the Proxy.

The Proxy could return an ArrayCollection and the PopUp could have a Datagrid instead of a Panel, you could then set the dataProvider to the ArrayCollection. Any way have a look and hopefully will be of some use.
0
 

Author Comment

by:hallikpapa
ID: 24103184
Thanks. FlexEvent.CREATION_COMPLETE

That is exactly what I was needing. Didn't know about it. Thank you so much for the complete example. You did a couple other things that are better/a lot cleaner too than I do. Good tips!
0
 

Author Closing Comment

by:hallikpapa
ID: 31568080
Excellent example
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question