I am using the PrimeFaces p:autoComplete in the search form of my project. The user can choose how many and which form elements (search parameters) he wants to include, so I need to pass the identifier to completeMethod for each of them. I tried adding onfocus=".." to pass the object to the bean, but this will only be activated when the element is first loaded.
My question is: how do I pass the completeMethod attribute?
XHTML element (simple):
<p:autoComplete value="#{filter.value}" label="dynamic search attribute" completeMethod="#{myBean.complete}" />
bean (simple):
@Named("myBean") public class MyController implements Serializable { public List<String> complete(String query) { List<String> results = new ArrayList<String>();
In theory, this would seem like an ideal solution:
<p:autoComplete value="#{filter.value}" label="dynamic search attribute" completeMethod="#{myBean.complete(filter)}" />
And again bean:
@Named("myBean") public class MyController implements Serializable { public List<String> complete(String query, FilterObject o) { List<String> results = new ArrayList<String>();
Simon plangger
source share