Re: WOPopupButton Confusion...
Re: WOPopupButton Confusion...
- Subject: Re: WOPopupButton Confusion...
- From: Brendan Duddridge <email@hidden>
- Date: Sat, 28 Feb 2004 15:31:46 -0700
James,
You appear to be nulling out your aCustomers array each time this method
gets called:
public NSArray aCustomers() {
NSArray aCustomers = new NSArray();
Portfolio portfolio = ((Session) session()).portfolio();
if (portfolio != null) {
if (portfolio.customers() != null) {
aCustomers = portfolio.customers();
}
}
return aCustomers;
}
Try this:
NSArray aCustomers = null;
public NSArray aCustomers() {
if (aCustomers == null) {
aCustomers = new NSArray();
}
Portfolio portfolio = ((Session) session()).portfolio();
if (portfolio != null) {
if (portfolio.customers() != null) {
aCustomers = portfolio.customers();
}
}
return aCustomers;
}
That9s called lazy instantiation. Of course, maybe you intended on creating
a new aCustomers array each time through. Not sure. If you were to do this,
it9s possible that the selectedItem will never stick because each time
through you9re retrieving a new array of portfolio.customers() objects. The
selectedItem binding must contain a value that exists in your original
array. If you9re creating a new aCustomers array each time you display your
page, the next time your pop-up is displayed, the selectedCustomer might not
be found in your array and so it would appear that it9s not sticking. Think
of the selection binding as an object index into the array bound to the list
binding.
By the way, I didn9t see any bindings to your datasetQ1() method. It9s
possible that you have other components on your page bound to that method.
It will get called once for each binding you have.
Hope that helps!
___________________________
Brendan Duddridge
ClickSpace Interactive Inc.
Suite L100
239 - 10th Ave SE
Calgary, AB T2G 0V9
Canada
(403) 277-5591
http://www.clickspace.com/
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.