Hi Johan,
It looks like you didn't inject the Persons repository into your class.
This should work:
public List<Person> autoComplete1CreateContact(String search) {
return *persons*.findPersons(search);
}
...
@Inject
Persons *persons*;
On Tue, Oct 7, 2014 at 8:54 PM, <[email protected]> wrote:
>
>
> Can somebody explain how to get autocomplete working in wicketviewer? I
> tried to follow [1] but I get stuck.
>
> Here is my code. The method Persons.findPersons(String search) is working.
> Now I want to use it as a lookup in PersonContacts class to add another
> Person as a contact. But is doesn't work as I expected...
>
>
>
>
> public class PersonContacts extends SocratesDomainService{
>
>
>
> public PersonContacts() {
>
> super(PersonContacts.class, PersonContact.class);
>
> }
>
>
>
> @MemberOrder(name = "PersonContacts", sequence = "1")
>
> @Named("Voeg contact toe")
>
> @NotInServiceMenu
>
> public PersonContact createContact(
>
> final Person owner,
>
> @Named("Contact") final Person contact,
>
> @Named("Level") final Integer level
>
> ) {
>
> final PersonContact pc =
> container.newTransientInstance(PersonContact.class);
>
> pc.setOwner(owner);
>
> pc.setContact(contact);
>
> pc.setLevel(level);
>
> container.persistIfNotAlready(pc);
>
> return pc;
>
> }
>
>
>
> public List autoComplete1CreateContact(String search) {
>
> return Persons.findPersons(search);
> }
>
>
>
> Greetz,
>
> Johan
>
>
>
> [1]
> http://isis.apache.org/how-tos/how-to-03-025-How-to-specify-an-autocomplete-for-an-action-parameter.html
>
>
>
>