I have a primefaces p:autocomplete
component my question is if it is possible to paste several elements at the same time.
The component:
<p:autoComplete dropdown="true" id="instalacion" maxResults="100"
value="#{principalView.cochesSeleccionados}"
completeMethod="#{principalView.completeText}"
forceSelection="true" multiple="true"
emptyMessage="Ningun dato coincide">
</p:autoComplete>
The bean:
@ManagedBean(name="principalView")
@ViewScoped
public class PrincipalView {
List<String> results;
List<String> cochesSeleccionados;
@PostConstruct
public void init() {
results = new ArrayList<String>();
results.add("BMW");
results.add("AUDI");
results.add("SEAT");
}
public List<String> completeText(String query) {
return results;
}
// gettter and setter
public List<String> getCochesSeleccionados() {
return cochesSeleccionados;
}
public void setCochesSeleccionados(List<String> cochesSeleccionados) {
this.cochesSeleccionados = cochesSeleccionados;
}
}
My intention is to be able to copy from a site the elements:
BMW SEAT and by pasting it on the selected component.
Hi, I haven't seen much on the subject. but I hope I can help you.. check the PrimeFaces page
https://www.primefaces.org/showcase/ui/input/autoComplete.xhtml
there is a practical example of multiselect that I think you are looking for
I hope it is helpful
In the end I got it by putting a button that opens a modal with a
inputTextArea
where we will paste the list of elements to paste.The java part:
Obviously now if we paste any element in the inputTextarea it will put it as if it existed.