Solved

Closing Pop Up empties my ArrayCollections

Posted on 2009-04-08
6
270 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now