简体   繁体   中英

Primefaces autocomplete multiple with forceSelection false

I'm using Primefaces 6.0, in which <p:autocomplete> doesn't work with multiple=true and forceSelection=false .

You can find the component below:

 <p:autoComplete value="#{bean.value} 
      multiple="true"
      completeMethod="#{bean.completeTheme}"
      forceSelection="false"/>

How can I insert a custom value not listed?

You can always add your inserted custom value in your complete method, like this:

public List<String> completeMethod(String query) {
    List<String> suggestions = new ArrayList();
    suggestions.add(query);

    //... add more suggestions
    return suggestions;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM