Nevermind. I ended up going with this approach where I could separate the values:
http://cwiki.apache.org/WICKET/autocomplete-using-a-wicket-model.html I will add my code snippet to the page. cheers, Steve On 21/12/2009, at 11:57 AM, Steve Swinsburg wrote: > Hi, > > I am using ObjectAutoCompleteField from WicketStuff and it looks like what I > need for my scenario: > > I have an object list with a bunch of fields and when the user searches, it > needs to match on a certain field and display the list of matches. The > examples do this with a Car object with an Integer field for the ID and a > String for the car name. > > However, there seems to be no way to tell it *what* fields to use in the > supplied object. You can only give the component the Type of fields to look > up, and it gets the field to use by reflection. This assumes only one field > in that object will be of that Type. > > ie > > How could I make it would with a list of these objects: > > class Person { > > String userId; > String displayName; > ... > > } > > Giving the ObjectAutoCompleteField the types <Person,String> won't work, it > won't know what field to use. > > > List<Person> persons = getPersons(); > > ObjectAutoCompleteBuilder<Person,String> builder = new > ObjectAutoCompleteBuilder<Person,String>( > new AutoCompletionChoicesProvider<User>() { > public Iterator<Person> getChoices(String input) { > List<Person> subSet = getPersonSubSet(persons, > input); > return subSet.iterator(); > } > } > ); > ObjectAutoCompleteField toField = builder.build("toField", new > Model<String>()); > form.add(toField); > > > Any ideas? > > thanks, > Steve
