[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Closing Pop Up empties my ArrayCollections

Posted on 2009-04-08
6
Medium Priority
?
288 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
  • 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] Oticon Case Study

Open office environments can create the dynamics for innovation, but they also bring some challenges. With over 1,000 employees in an open office, Oticon needed a solution that would preserve the environment while mitigating disruptive background noises.

Watch how they did it.

 
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

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

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…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month18 days, 13 hours left to enroll

834 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