Re: detail WODisplayGroup & FetchSpec
Re: detail WODisplayGroup & FetchSpec
- Subject: Re: detail WODisplayGroup & FetchSpec
- From: Patrick Robinson <email@hidden>
- Date: Mon, 24 May 2004 10:18:02 -0400
On May 24, 2004, at 9:27 AM, Nathan Dumar wrote:
If I feed this array to a WORepetition ...
NSArray users =
EOUtilities.objectsWithQualifierFormat(editingContext, "User", "org =
%@ and userType.typeNum > 0 and userType.typeNum < 9", new
NSArray(orgObject));
... how do I select one iteration to edit?
With a WODisplayGroup, I would just put a WOHyperlink around one of
the strings from one of the user iterations. That link would be
connected to a method with ...
userDisplayGroup.selectObject();
The edit form fields are connected to
userDisplayGroup.selectedObject.<someAttribute>
How the select knew which object to pick is magic to me. But if I'm
going to forego WODisplayGroups, I need to mimic this functionality
(hopefully as eloquently as the quoted code). In a WORepetition that
doesn't use a WODisplayGroup, how do I select one object and connect
that object to an edit form's fields?
Bind the WORepetition's list attribute to your users array, and bind
its item attribute to an instance variable of the type of your User
items (maybe EOGenericRecord? perhaps User?). Let's call the variable
aUser. Inside the WORepetition, you could wrap a WOHyperlink around a
WOString. Bind the string's value to aUser.someAttribute. Create an
action method, selectUser(), and bind the hyperlink's action attribute
to this method. You'll also want an instance var (I'll call it
selectedUser) of the same type (e.g. User) to hold the selected object.
selectUser() might look like this:
public WOComponent selectUser() {
selectedUser = aUser;
return null;
}
Now bind your edit form fields to selectedUser.someAttribute.
--
Patrick Robinson
AHNR Info Technology, Virginia Tech
email@hidden
_______________________________________________
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.