WOPopUpButton Used For A Search
WOPopUpButton Used For A Search
- Subject: WOPopUpButton Used For A Search
- From: "Jonathan Fleming" <email@hidden>
- Date: Wed, 26 Feb 2003 13:13:23 +0000
I've created a simple search and edit page with WebObject's wizard and want
to use a popup to list an attribute/property that I can select from when
doing a search, problem is I can not seem to get the bindings right.
This is the actual page:
// Generated by the WebObjects Wizard Wed Jan 15 02:23:23 GMT 2003
import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;
public class NavSearchAddEditPage extends WOComponent {
/** @TypeInfo TbNavPage */
protected EOEnterpriseObject tbnavpage;
// This WODisplayGroup is initialized from the .woo archive in the
component's constructor method
protected WODisplayGroup tbnavpageDisplayGroup;
public NavSearchAddEditPage(WOContext context) {
super(context);
}
public void selectObject() {
tbnavpageDisplayGroup.selectObject(tbnavpage);
}
public void saveChanges() throws Exception {
try {
this.session().defaultEditingContext().saveChanges();
} catch (Exception exception) {
// An error occurred during the save. You could present an error
page which
// explains the reason for the save failure.
// The default is to raise an exception which presents a
diagnostic page.
NSLog.err.appendln("Cannot save changes ");
throw exception;
}
}
/** @TypeInfo TbNavPage */
public NSArray sortedNavPageNames()
{
// create new navPage list
EOEditingContext ec = this.session().defaultEditingContext();
NSMutableArray sortedNavPageNameList = new
NSMutableArray(EOUtilities.objectsForEntityNamed(ec, "TbNavPage"));
// Sort ordering created here to sort unsorted clients
EOSortOrdering navPageNameSortOrdering =
EOSortOrdering.sortOrderingWithKey("navPageName",
EOSortOrdering.CompareAscending);
NSArray sortOrderings =
new NSArray( new Object[]{navPageNameSortOrdering});
// Sort away!
EOSortOrdering.sortArrayUsingKeyOrderArray(sortedNavPageNameList,
sortOrderings );
return sortedNavPageNameList;
}
And these are the binding I have set at the moment which are not working
CategoryPopUp: WOPopUpButton {
displayString = tbnavpage.navPageName;
item = tbnavpage;
list = sortedNavPageNames;
name = "navPagePopupList";
value = tbnavpage.navPageName;
selection = tbnavpage;
}
I've used popUps to enter datainto myEO's but I have not used one in a
search and don't know where I am going wrong here.
Kind regards
Jonathan
Ps. I know that I can use tbnavpageDisplayGroup.displayedObjects for the
list but that was not working so I created a new NSMutableArray as you have
seen.
_________________________________________________________________
Chat online in real time 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.