PrimeFaces AutoComplete完成,并具有额外的参数
我在使用完成的数据台上具有自动完成的数据。是否可以将行对象传递到完成的bean实现,或者以某种方式让bean知道我当前正在工作的行对象?谢谢。
伪代码:
<p:dataTable var="selection" value="#{bean.selections}">
<p:column headerText="Selection">
<p:autoComplete id="dd" dropdown="true" value="#{bean.country}"
completeMethod="#{bean.completeText(selection)}">
<p:ajax event="itemSelect"/>
</p:autoComplete>
</p:column>
</p:dataTable>
I have autoComplete inside dataTable which is using completeMethod. Is it possible to pass row object to the completeMethod bean implementation or somehow let the bean know on which row object I am currently working? Thank you.
Pseudo code:
<p:dataTable var="selection" value="#{bean.selections}">
<p:column headerText="Selection">
<p:autoComplete id="dd" dropdown="true" value="#{bean.country}"
completeMethod="#{bean.completeText(selection)}">
<p:ajax event="itemSelect"/>
</p:autoComplete>
</p:column>
</p:dataTable>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
橡皮鸭效应,很抱歉这么快回答我自己的问题。我已经将完成对象移到了选择对象上,在我的情况下,我需要所有需要的其他参数。希望有人发现它有用。
Rubber duck effect, sorry for answering my own question so fast. I have moved my completeMethod to selection object, which in my case holds all the additional parameters I need. Hope someone finds it useful.
您可以将命令 / ajax组件中的属性传递给您的操作 /侦听器方法,例如:
在您的bean方法中,您可以访问属性,例如:
根据您的要求,您可以直接传递行var实例,或者只是“ ID / ROWKEY”和手动查找。
You can pass attributes in command / ajax components to your action / listener method like:
In your bean method you can access attributes like:
Depending on your requirement you can either pass the row var instance directly or maybe just the "id / rowkey" and look it up manually.