简体   繁体   English

Primefaces使用forceSelection false自动完成多个

[英]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 . 我使用的是Primefaces 6.0,其中<p:autocomplete>不适用于multiple=trueforceSelection=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;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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