Solved

Closing Pop Up empties my ArrayCollections

Posted on 2009-04-08
6
276 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
Surfing Is Meant To Be Done Outdoors

Featuring its rugged IP67 compliant exterior and delivering broad, fast, and reliable Wi-Fi coverage, the AP322 is the ideal solution for the outdoors. Manage this AP with either a Firebox as a gateway controller, or with the Wi-Fi Cloud for an expanded set of management features

 
LVL 5

Accepted Solution

by:
Fuzzy_Logic_ earned 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

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 article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

749 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