I have following method:
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(named = "Find alphabet Soup by Letter", bookmarking = BookmarkPolicy.AS_ROOT)
@MemberOrder(name = "Menu soups", sequence = "7")
public List<SomeObject> findByLetter(@ParameterLayout(named = "letter") final String letter) {
return container.allMatches(new QueryDefault<SoupObject>(SoupObject.class, "findSoupQuery", "letter", letter));
}
I want that the Input-field for the parameter letter
is a dropdown-list with autoCompletion.
So I added the autoComplete function:
public Collection<String> autoComplete0FindByLetter(@MinLength(3) String search) {
List<String> ret = new ArrayList<String>();
SoupFinder soupFinder = new SoupFinder();
List<SoupObject> soups = soupFinder.findByLetter(search);
for (SoupObject tmpSoup : soups) {
ret.add(tmpSoup.getName(());
}
return ret;
}
So my problem is now: When I use the function findByLetter
in the Wicked UI there is no dropdown field for the parameter letter
.
Why is there no dropdown field respectively why does the autoComplete function not work. Did I forget something?
Thanks for your answers.
Autocomplete only works with entities/view models, not with values. Which kind-of makes sense: the point of autoComplete is to do a lookup of existing entities. For strings, you can use choices, but not autoComplete.
I'm not sure if this is properly documented ... until I looked into it, I too thought that your code looked correct.
The closest you can get to the behaviour you are after is to use a very simple view model as a wrapper around the string, eg:
@ViewModel
public class Choice {
@Getter @Setter
private String value;
}
and return a list of those.