Re: [swiz-framework] Issue with loss of data when navigator.pushView(someView) is used

53 views
Skip to first unread message

Brian Kotek

unread,
Sep 17, 2012, 3:53:09 PM9/17/12
to swiz-fr...@googlegroups.com
Not sure I follow. Are you saying that you set up the variable as a new ArrayCollection, and then at some later time something is setting it to null? If so, you could add a get/set pair for the property and use log messages or the debugger to see what is setting it to null.


On Mon, Sep 17, 2012 at 2:23 PM, Dubnet <pay...@dubnet.co.uk> wrote:
I have set up a Swiz project and all seems well.  Im building an app using TabbedViewNavigatorApplication.
I have declared my beans in the configuration file and have 2 views and an xml service which I have set up using the connect to data Flex tool.
In the controller, I have a bindable ArrayCollection which is populated after a call to the method on the cfc on the server. It populates and is bound to the spark List component as its data provider.

When navigator.pushView(someView) is called - the ArrayCollection is set to null.

Any clues as to why this is happening?

--
You received this message because you are subscribed to the Google Groups "Swiz Framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/swiz-framework/-/U3eg1pAr5RoJ.
To post to this group, send email to swiz-fr...@googlegroups.com.
To unsubscribe from this group, send email to swiz-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swiz-framework?hl=en.

Dubnet

unread,
Sep 18, 2012, 5:19:58 AM9/18/12
to swiz-fr...@googlegroups.com
yes that is what seems to be happening and it seems to be when I move away from the first view. 

Ive set up the ArrayCollection with getter/setter functions and have put a break point in the setter but nothing happens. If something is setting it to null then it should fire right? When I navigate away then I get an error when the ArrayCollection is trying to be accessed.

Code:

                private var _ips:ArrayCollection = new ArrayCollection;
[Bindable(event="ipsChanged")] 
// Define public getter method. 
public function get ips():ArrayCollection 
return _ips; 
// Define public setter method. 
public function set ips(value:ArrayCollection):void 
_ips = value;
// Create event object.  
var eventObj:Event = new Event("ipsChanged"); 
dispatchEvent(eventObj); 
}

Dubnet

unread,
Sep 18, 2012, 7:16:25 AM9/18/12
to swiz-fr...@googlegroups.com
As it stands the ArrayCollection is declared in the controller and I inject it into the view I need. It seems that it needs to be sitting in a model so that I can keep all my data together. Im new to Swiz so what Im thinking of doing is to declare a model bean in the config say: <ipmodel:IpModel id="ipModel"/> then inject the model into the controller which will set the data to the ArrayCollection after its retrieved it. 

Would I then inject the model or the controller into the view needing the ArrayCollection?
Reply all
Reply to author
Forward
0 new messages