[英]PrimeFaces and visible autocomplete in SelectOneMenu
Is there any way to achieve the following requirement:有什么办法可以达到以下要求:
SelectOneMenu
with autocomplete,SelectOneMenu
, I guess it should be a combination of (customized) filtering
, editable
input and server-side validation, but I did not find out how.我猜它应该是(自定义)
filtering
、 editable
输入和服务器端验证的组合,但我没有找到如何实现的。
The question is old of cource but it will be helpful to others so giving the answer.这个问题很老,但它会对其他人有所帮助,所以给出答案。
Yes it is possible to get them both.是的,可以同时获得它们。 Below is the example from the PrimeFaces demo for the editable combobox.
以下是可编辑 combobox 的 PrimeFaces 演示示例。
<p:outputLabel for="city" value="Editable: " />
<p:selectOneMenu id="city" value="#{selectOneMenuView.city}" effect="fold" editable="true">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{selectOneMenuView.cities}" />
</p:selectOneMenu>
You can add another attribute to this one and get the characteristics of advanced also together with the editable.您可以向该属性添加另一个属性,并获得高级特性以及可编辑特性。
<p:outputLabel for="city" value="Editable: " />
<p:selectOneMenu id="city" value="#{selectOneMenuView.city}" effect="fold" editable="true" filter="true" filterMatchMode="startsWith">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{selectOneMenuView.cities}" />
</p:selectOneMenu>
And you are done.你完成了。 You got both.
你有两个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.