Pop Ups & PureMVC woes

I asked a question early today. Located here. I thought it solved my problem with the Flash Event, but after trying multiple times. The problem still exists. My list is populated with data on the first opening of the pop up, but every time you open it afterwards, it's empty.

Here is the constructor, and case statement that is executed after the pop up is opened.

And this is the original post. Extremely frustrated....
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Flex/Q_24306064.html

//CONSTRUCTOR: _onGetColumns retrieves the columns from another component successfully after pop up opened
public function ManageColumnsMediator(viewComponent:Object)
{
	super( NAME, viewComponent );
	viewComponent.addEventListener(FlexEvent.CREATION_COMPLETE, _onGetColumns);
	
}
 
//CASE statement in mediator that executes after columns are retreived successfully
 
case ApplicationFacade.COLUMNS_RETRIEVED:
	trace("Got Columns"); //JUST TO MAKE SURE I MAKE IT TO THIS CASE STATEMENT AFTER POP UP OPENED (TRUE)
	var list:List = new List();
	var cols:Array = new Array();
	cols = note.getBody() as Array;
	list.dataProvider = cols;
	list.labelField = cols.headerText;
       trace(mx.utils.ObjectUtil.toString(col));  //THIS PRINTS ALL THE DATA EACH TIME
	manageColumns.addChild(list);	
	break;
 
//GETTING VIEW COMPONENT
public function get manageColumns():ManageColumns
{
	return viewComponent as ManageColumns;
}

Open in new window

hallikpapaAsked:
Who is Participating?
 
zzynxConnect With a Mentor Software engineerCommented:
0
 
zzynxSoftware engineerCommented:
Just a question:

>> manageColumns.addChild(list);

is it needed to build up that (=the content of the popup window) every time?
Can't you build it up once and then for all other times just alter the list's dataprovider?
0
 
hallikpapaAuthor Commented:
No, I didn't think so. I had tried it like that based on an expert's suggestion. Originally I just had an  in my view component with cols being my dataProvider there. It's the same problem, it is showing the data in my trace after CREATION_COMPLETE is fired, but not in the list; only the first time.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
zzynxSoftware engineerCommented:
can I see _onGetColumns?
0
 
hallikpapaAuthor Commented:
sure
private function _onGetColumns(fe:FlexEvent):void
		{
			trace("getting columns");
			this.sendNotification(ApplicationFacade.RETRIEVE_COLUMNS);
		}
..
...
...
...
...
case ApplicationFacade.RETRIEVE_COLUMNS:
		   			var col:Array = this.analyticsView.reportsGrid.columns;		   			
		   			this.sendNotification(ApplicationFacade.COLUMNS_RETRIEVED, col);
		   			break;

Open in new window

0
 
zzynxSoftware engineerCommented:
So you send the retrieved columns with the notification
>> this.sendNotification(ApplicationFacade.COLUMNS_RETRIEVED, col);

And here
>> cols = note.getBody() as Array;
you get them out.
Are you sure that here they are available?

What does getBody() looks like?
0
 
hallikpapaAuthor Commented:
It's a trace/dump of the col array that was sent. I went through and checked and all the columns are there. I also hit a breakpoint in Flex Builder and it is displaying everything correctly. I am using the most current version of PureMVC, but not the multi core one if that means anything
0
 
zzynxSoftware engineerCommented:
Running out of ideas to help. Sorry.
0
 
hallikpapaAuthor Commented:
Yeah, I am going to abandon the pop up, and just do it in a panel on the right. It works great that way.

How about this. I have put this list in a panel to the right of the grid. I can drag it open and closed, but is there some component that will "snap" it open and closed?

I have seen collapsible menus, but they are horizontal. I would like to make it vertical, along the right side of the screen.
0
 
zzynxSoftware engineerCommented:
>> is there some component that will "snap" it open and closed?
We made our own OurHDevidedBox (extending HDevidedBox) and OurBoxDivider (extending BoxDivider) having that functionality
0
 
zzynxSoftware engineerCommented:
0
 
hallikpapaAuthor Commented:
I like this much better. Thanks!
0
 
zzynxSoftware engineerCommented:
Thanx 4 axxepting
0
 
Fuzzy_Logic_Commented:
I realise that you are dropping the popUp window, but its bugging me why the popUp is not being populated.

My line of thinking at the moment is that an object gets added to the popUp everything works fine initially. When you close the popUp this object is left stranded, this stranded object receives the 'columns' but a new blank object gets added to the popUp.
 
0
 
hallikpapaAuthor Commented:
Trust me. It's bugging me too. I have another app I was trying to accomplish the same thing. And it behaves in the exact same manner. First initial pop up it works fine. Every time it opens afterwards, it is blank.

The really puzzling thing is the final step, after the pop up is created, I am populating/tracing the dataProvider. And it's all there.

The ONLY thing I can think of is I had a problem similar to this with an older version of PureMVC (I am using the current build though). And this one function that dealt with a pop up would not let me set it without passing the data, and retrieving through notification.getBody() in a switch statement.

I was going to ask Cliff from PureMVC about this. I am going to create a dummy project tonight with the exact same scenario, and post it if you like.
0
 
Fuzzy_Logic_Commented:
That would be really helpful.

FL
0
 
hallikpapaAuthor Commented:
Here is a link to the project archive. I am printing all the objects the first time, but every other time you open the pop up window, the list is empty.

http://www.mediafire.com/?czyxntnmydg 

Watch the trace logs, you see the cols field being populated.
0
 
Fuzzy_Logic_Commented:
Well I was nearly right.

You are not removing the mediator.

What is happening is first run:

PopUpMediator1 built (Name = "popUpMediator") PopUpWindow1 built List added by first Mediator with name "popUpManager" which references PopUpWindow1

PopUpManager removes PopUpWindow1 but PopUpMediator1 still has reference so it is not destroyed.

second run:

PopUpMediator2 built (Name = "popUpMediator" ) PopUpWindow2 built List added by the first Mediator with name "popUpManager" which is the first one that was built which references PopUpWindow1

PopUpManager removes PopUpWindow2 but PopUpMediator2 still has reference so it is not destroyed.

Essentially you end up with a load of PopUpMediators each one with its own PopUpWindow. But when pureMVC looks for the Mediator it will got to the first one in the list which has a reference to PopUpWindow1 and thats the one that always receives the column list. You only ever see that PopUpWindow on the first run.

 Think thats as clear as mud :-)

PopUpMediator.as
 
        public function PopUpMediator(viewComponent:PopUp):void
        {
            
            super(NAME, viewComponent);
            viewComponent.addEventListener(FlexEvent.CREATION_COMPLETE, popUpCreation_Complete);
            viewComponent.addEventListener(CloseEvent.CLOSE, popUp_Close);
             
            
        }
 
        private function popUp_Close(ce:CloseEvent):void
        {
            
           sendNotification(AppFacade.CLOSE_POPUP, viewComponent as PopUp);
            
        }
 
 
and in ClosePopUpWindowCommand.as
 
        override public function execute(notification:INotification):void
        {
           // Remove the mediator
            facade.removeMediator(PopUpMediator.NAME);
           
        }
 

Open in new window

0
 
hallikpapaAuthor Commented:
That totally makes sense now that I can see that. THank you for taking the time and pointing it out. It will definetly help out in future projects!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.