• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOPopupButton Confusion...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: WOPopupButton Confusion... SOLVED
  • Next by Date: Re: WOPopupButton Confusion... SOLVED
  • Previous by thread: Re: WOPopupButton Confusion... SOLVED
  • Next by thread: Re: webobjects-dev digest, Vol 1 #818 - 3 msgs
  • Index(es):
    • Date
    • Thread