Re: EODisplayGroup
Re: EODisplayGroup
- Subject: Re: EODisplayGroup
- From: Nathan Dumar <email@hidden>
- Date: Fri, 18 Jun 2004 13:51:44 -0400
On Jun 18, 2004, at 8:56 AM, Yves Custeau wrote:
But if you have a value that is within the data? I still cannot
understand
how I could use the following function to search:
anEOdg.selectObject(personObj);
It's not a function to search; it's a function to select.
There are a number of ways to use this function, all depending on the
context. If this a list in the user's browser, using a WORepetition of
products, then the "productObject" is one iteration in that list. (If
you need help with the WORepetition, it's also covered in the doc "Web
Applications" ... here's the page:
http://developer.apple.com/documentation/WebObjects/Web_Applications/
State/chapter_8_section_3.html ) For each iteration, you're displaying
properties of a product object in WOStrings. Wrap a WOHyperlink around
one of these strings and connect the action attribute to an action that
contains the line
anEOdg.selectObject(productObject);
That's the easiest way to establish a selection from the UI.
Where do you get that "personObj" from to perform the selection ? What
type
of object is it?
personObj was just an example I made up, because I didn't know what
type of data you were dealing with (I should have used something like
exampleObject). For the context you're indicating, a productObject is
more appropriate. It's whatever objects are in your EODisplayGroup.
For example if the user types the Product_Number in a textfield, how
can I
use this function to search for the object that has Product_Number ==
10
and make that Object the current (or selected) object??
I know of two ways to do this fairly easily. One of them is to iterate
through the list, as you talked about in your first post ...
I can traverse the result set with a FOR loop and get the associated
value
using:
eodisplaygroup.valueForObjectAtIndex(i,"valuetoretrieve").toString()
The other is to construct an EOQualifier and do:
productObjectArray =
EOQualifier.filteredArrayWithQualifier(anEOdg.allObjects(), qual);
In both cases, you've only obtained results from a search. If you want
the resulting object(s) to be selected in your EODisplayGroup, then you
still need to set the selection.
// to select one object from using the FOR loop
anEOdg.selectObject( (ObjectClass)anEOdg.allObjects().objectAtIndex(i)
);
// to select one or more objects from using the EOQualifier
anEOdg.selectObjectsIdenticalTo(productObjectArray)
Nathan
_______________________________________________
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.