primeFaces futther下拉值显示
我有一个奇怪的情况,需要动态填充下拉值。我想出的最好的想法是创建一个按钮,该按钮触发Ajax请求,该请求获取新的下拉值并完整更新下拉列表并显示它。
我想知道是否还有其他更优雅的处理方式。我正在使用最新的PrimeFaces版本11.0.0。
I have a strange situation where one needs to dynamically populate dropdown values. The best idea I have come up with is creating a button, which triggers ajax request that fetches new dropdown values and on complete updates the dropdown and displays it.
I was wondering if there is any other more elegant way of handling situations like this. I am using the latest primefaces version 11.0.0.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议将
p:autocomplete
组件与下拉
属性设置为true
而不是。它允许您在单击按钮或键入查询时获取值。您无需考虑自己更新组件。您唯一需要做的就是在bean中拥有完成
或ploteendpoint
(REST ENDPOINT)。使用PrimeFaces 12,您甚至可以(重新)使用
lazydatamodel
作为建议提供商。I suggest to use the
p:autoComplete
component with thedropdown
attribute set totrue
instead. It allows you to get the values when the button is clicked or when a query is typed. You don't need to take care of updating the component yourself. The only thing you need to do is have acompleteMethod
in your bean or have acompleteEndpoint
(REST endpoint).With PrimeFaces 12 you can even (re)use a
LazyDataModel
as a suggestions provider.