Re: [webobjects-newbies] WOPopUpButton Used For A Search
Re: [webobjects-newbies] WOPopUpButton Used For A Search
- Subject: Re: [webobjects-newbies] WOPopUpButton Used For A Search
- From: "Jonathan Fleming" <email@hidden>
- Date: Tue, 04 Mar 2003 01:44:16 +0000
Thanks Kent,
I'll be back in touch
Jonathan
From: Kent Thomas <email@hidden>
To: "Jonathan Fleming" <email@hidden>
Subject: Re: [webobjects-newbies] WOPopUpButton Used For A Search
Date: Mon, 3 Mar 2003 18:06:50 -0700
Jonathan,
Here's how I'm doing it.
public Accounts eachAccount;
public Accounts selectedAccount;
public NSArray accountsList;
public NSMutableDictionary bindings;
public WODisplayGroup accountsDisplayGroup;
Here are the bindings for the Popup List:
displayString --> eachAccount.name
item --> eachAccount
list --> accountsList
noSelectionString --> ""
selection --> selectedAccount
In your call to super, add the following line:
bindings = new NSMutableDictionary();
Searches go as follows:
public WOComponent searchAccounts()
{
EOEditingContext ec = session().defaultEditingContext();
bindings.takeValueForKey(selectedAccount.name, "name");
bindings.takeValueForKey("Active", "use");
NSArray foundAccounts =
EOUtilities.objectsWithFetchSpecificationAndBindings(ec, "Accounts",
"fetchActiveAccounts", bindings);
accountsDisplayGroup.setObjectArray(foundAccounts);
accountsDisplayGroup.setCurrentBatchIndex(1);
return null;
}
The I've defined a Fetch Specification in my modeld file for the Accounts
database. The fetch specification is called fetchActiveAccounts. That
fetch specification has 3 bindings as follows. ((name = $name) and (use =
$use) and (email = $email))
(You can keep adding one of these for each field you wish to search on.)
For the Display Group Bindings, I've left everything standard. No
batching, (You can batch) there are no data sources or fetch
specifications because we're manually loading the DisplayGroup. It is
simply an implimentation of the Accounts database.
In my search form, I've bound the text filed as follows:
value --> email
Then bind the searchAccounts to the action of your submit button, and
you're ready to go.
I hope this helps. Let me know if you think I can improve this any.
Good luck
Kent
On Monday, March 3, 2003, at 03:10 PM, Jonathan Fleming wrote:
I would love to see what you are doing kent,
I have actually posted a solution that I am using but having the code to
another or even better solution would be great
Regards
Jonathan
From: Kent Thomas <email@hidden>
Reply-To: email@hidden
To: email@hidden
Subject: Re: [webobjects-newbies] WOPopUpButton Used For A Search
Date: Wed, 26 Feb 2003 06:34:58 -0700
Jon,
I'll give it a shot.
CategoryPopUp: WOPopUpButton {
displayString = tbnavpage.navPageName;
item = tbnavpage;
list = sortedNavPageNames;
name = "navPagePopupList";
value = tbnavpage.navPageName;
selection = tbnavpage;
}
CategoryPopUp: WOPopUpButton {
displayString = tbnavpage.navPageName;
item = tbnavpage;
list = sortedNavPageNames;
name (not needed)
value (not needed)
selection (not needed)
}
Item is what you would be searching for.
I don't think you need this guy. use tbnavpage which is bound to the
item of your popup list.
public void selectObject() {
tbnavpageDisplayGroup.selectObject(tbnavpage);
}
I don't see where you are actually using this to perform a search of
the database. I'm doing my searches differently than this, I don't know
if it is easier. If you wish, I can show you the code.
Kent
_________________________________________________________________
Worried what your kids see online? Protect them better with MSN 8
http://join.msn.com/?page=features/parental&pgmarket=en-
gb&XAPID=186&DI=1059
_________________________________________________________________
Stay in touch with MSN Messenger http://messenger.msn.co.uk
_______________________________________________
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.