primeFaces futther下拉值显示

发布于 2025-01-27 12:32:14 字数 134 浏览 2 评论 0原文

我有一个奇怪的情况,需要动态填充下拉值。我想出的最好的想法是创建一个按钮,该按钮触发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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吾家有女初长成 2025-02-03 12:32:14

我建议将p:autocomplete组件与下拉属性设置为true而不是。它允许您在单击按钮或键入查询时获取值。您无需考虑自己更新组件。您唯一需要做的就是在bean中拥有完成ploteendpoint(REST ENDPOINT)。

使用PrimeFaces 12,您甚至可以(重新)使用lazydatamodel作为建议提供商。

I suggest to use the p:autoComplete component with the dropdown attribute set to true 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 a completeMethod in your bean or have a completeEndpoint (REST endpoint).

With PrimeFaces 12 you can even (re)use a LazyDataModel as a suggestions provider.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文