Re: WOPopUpButton Used For A Search SOLVED!!!
Re: WOPopUpButton Used For A Search SOLVED!!!
- Subject: Re: WOPopUpButton Used For A Search SOLVED!!!
- From: "Jonathan Fleming" <email@hidden>
- Date: Mon, 03 Mar 2003 17:16:15 +0000
Hi Chuck & George,
Just letting you know your efforts to get this popup situation sorted were
not in vain.
I thought it was going to be a simple matter having created a Display Group
page with the wizard, but it turned out to be a frustrating time. In the end
I changed the page and progmatically coded everything I needed including the
fetch spec.
The code from both of you to use the popup as a query item worked fine,
though I don't know If I have used it absolutly correctly in my query
section even though it works beautifully.
There was one other person that was asking for a solution to this as soon as
I had it and that was you Thomas... for anyone else who it may matter to I
hope it's good enough for you as it seems to be for me, here's what we did:
My EO was named navPageName, change this to whatever yours is:
I programatically created a fetchSpec but I don't suppose you have to do
that, I'll include it here anyhow:
declare and create your queryBindings such as
protected NSMutableDictionary queryBindings;
(in your constructor or chosen method) queryBindings = new
NSMutableDictionary();
public WOComponent lookupNavPage()
{
EOQualifier qualifier =
EOQualifier.qualifierToMatchAllValues(queryBindings );
EOSortOrdering navPageNameSortOrdering =
EOSortOrdering.sortOrderingWithKey("navPageName",
EOSortOrdering.CompareAscending);
NSArray sortOrderings =
new NSArray( new Object[]{navPageNameSortOrdering});
EOFetchSpecification fetchSpec = new
EOFetchSpecification("TbNavPage", qualifier, sortOrderings);
EOEditingContext myEditingContext =
this.session().defaultEditingContext();
navPageList =
myEditingContext.objectsWithFetchSpecification(fetchSpec);
if (selectedTbNavPageToSearch==null ) {
// search code
queryBindings.setObjectForKey( "", "navPageName" );
}
else if (selectedTbNavPageToSearch!=null)
{
// search code
queryBindings.setObjectForKey(
selectedTbNavPageToSearch.navPageName(), "navPageName" );
NSLog.out.appendln("\nQuery Match for navPageName = " +
selectedTbNavPageToSearch.navPageName());
}
//With this statement I chose to nullify the selection ready for a
fresh search query
//but you don't have to and your selection will stay in the popup
setSelectedTbNavPageToSearch(null);
return null;
}
/*-------------- Set & Get Methods for Popup --------------*/
public void setSelectedTbNavPageToSearch(TbNavPage newSelection) {
selectedTbNavPageToSearch = newSelection;
if (selectedTbNavPageToSearch==null ||
selectedTbNavPageToSearch.equals("") ) {
// search code
queryBindings.setObjectForKey( "", "navPageName" );
setSelectedTbNavPage( null );
}else
if (selectedTbNavPageToSearch!=null)
{
// search code
queryBindings.setObjectForKey(
selectedTbNavPageToSearch.navPageName(), "navPageName" );
}
}
public TbNavPage selectedTbNavPageToSearch() {
return selectedTbNavPageToSearch;
}
What I then did in WOBuilder is made the TextField box for the query
item (queryBindings.navPageName) hidden by choosing the static inspector and
selecting "Hidden field (entirly invisible)"
Now all that shows is ny popup doin what I wanted it to do in the forst
place.
If this is wrong someone please tell me how to make it better, but for
now all I can say is it works and it works extremly well.
Thanks for the help and patients that was shown as I was a bit muddled
on this.
Regads
Jonathan
_________________________________________________________________
Surf together with new Shared Browsing
http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=1059
_______________________________________________
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.