PDA

View Full Version : using the navigator property of View components


bibiki
11-22-2011, 08:11 AM
Hey there,
for my application, I have these three files (in addition to other files):
Orders
MakeAnOrder
ListAllOrders

In my Orders file I have defined two states: list and make.

So, I include my MakeAnOrder and ListAllOrders views (components) as follows:
<myPackage:MakeAnOrder includeIn="make"/>
<myPackage:ListAllOrders includeIn="list"/>
inside my Orders file.

Now, inside MakeAnOrder I have a button that invokes navigator.pushView(someView);, but it won't work. the error I get is that the navigator is null.

One way I circumvented this issue is by putting the button in Orders file and defining its' clickHandler in Orders file, but making it visible only in 'make' state. This worked fine functionally, but it complicates maintenance of code?

is there any other way to do this better?

Thank you for your reply.

solisarg
11-22-2011, 04:05 PM
Are MakeAnOrder and ListAllOrders s:View, I mean View classes?

Jorge

bibiki
11-23-2011, 09:55 AM
yes Jorge,
they are both View classes.

I circumvented the problem now making a field variable (ordersMain) inside my MakeAnOrder that is set equal to my Orders object upon the creation of MakeAnOrder.

now, when I want to pushView from MakeAnOrder, instead of writing navigator.pushView(some view), I do ordersMain.navigator.pushView(some view)

this does make things work properly.

if you perhaps have a better way, let me know. else, I'm marking this thread solved.

thank you for trying to help.