gpt4 book ai didi

jsf-2 - 素面 : how to get the value of a Filter column text

转载 作者:行者123 更新时间:2023-12-01 09:21:29 25 4
gpt4 key购买 nike

给定以下primefaces数据

<p:dataTable value="#{cc.attributes.playerCollection}" var="player"
widgetVar="playerWidgetTable" emptyMessage="#{uimsg.ui_not_recordsfound}">
<!-- filter event handler -->
<p:ajax event="filter" listener="#{cc.attributes.viewBean.listenFilter}" update="@this"/>

<!-- Player first name -->
<p:column id="firstnameColumn" headerText="#{uimsg.firstname}"
filterBy="#{player.firstName}" filterMatchMode="contains">
<h:outputText value="#{player.firstName}" />
</p:column>
</p:dataTable>

某人如何获得(在服务器端)用户在过滤器文本列中给出的过滤器“文本”值?

我试着用“listenFilter”监听过滤事件:

@ManagedBean
@ViewScoped
public class PlayerListBean implements Serializable {

......

public void listenFilter(FilterEvent event) {
// update datasource
Map<String, String> tempString = event.getFilters();

System.out.println("size filter: "+ tempString.size());
for (String key : tempString.keySet()) {
System.out.println("key: " + key + " \t values: "
+ tempString.get(key));

}

}

}

但我无法用它开始。他们还有其他选择吗?喜欢将 DataTable 作为绑定(bind)组件使用,否则?

谢谢

最佳答案

这对我来说很好......

public void listenFilter(FilterEvent event) {

DataTable table = (DataTable) event.getSource();
Map<String, String> filters = table.getFilters();
//grab the value from the required map key (somePropertyName if your filterBy
looks like filterBy="#{myBean.somePropertyName}") ...

}

关于jsf-2 - 素面 : how to get the value of a Filter column text,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13365451/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com