WOPopupButton - want a value list for a foreign key
WOPopupButton - want a value list for a foreign key
- Subject: WOPopupButton - want a value list for a foreign key
- From: "Thomas Peters" <email@hidden>
- Date: Sat, 14 Dec 2002 20:54:13 -0500
I want to fill a WOPopupButton with the values from a parent object. I found
an example that uses an NSArray. However, I wonder if I should handle things a
little differently than this:
public static NSArray getCategoryNames() {
return (NSArray)allCategories().valueForKey("categoryName");
}
public static NSArray allCategories() {
EOSharedEditingContext ec = session().defaultSharedEditingContext();
EODatabaseDataSource ds = new EODatabaseDataSource(ec,
"ProductCategory");
return ds.fetchObjects();
}
This works to fill the menu with names, but my Category data has cat_id &
cat_name. The foreign key in product is cat_id. I am trying to create a
WOComponent that has a popup with the categories. I have the popup list bound
the the getCategoryNames.
Some questions:
Is it better to use NSArray or should I create another displayGroup in the
WOComponent?
If I create a categoryDisplayGroup, how should I setup the bindings for the
WOPopupButton?
How can I create a multi-dimensional NSArray that stores the cat_id &
cat_name from the ProductCategory EObject?
I need an example of how to set the bindings up for this WOPopupButton to
store the value from the popup into an attribute of the bound EObject?
Thanks for the help.
_______________________________________________
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.