Solved

Closing Pop Up empties my ArrayCollections

Posted on 2009-04-08
6
275 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
flex remote display image 7 388
Button sound on mouseover 4 477
rebuild swf 5 474
doubt future Flex 4 434
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…
The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

838 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