【发布时间】:2014-11-12 03:18:02
【问题描述】:
我试图以某种方式添加到数据表的列过滤自动完成功能。我使用客户端的 LastNames 创建了 Set,还根据示例中的要求在我的 Bean 中使用 getter+setter 创建了 String 文本字段,但不知道如何将其添加到过滤器中。你能帮我解决一下吗!?
在 Bean 中
private Set<String> lastNames = new HashSet<String>(); //for autocomplite
private String text; //for autocomplite
数据表
<p:dataTable id="table" value="#{clientsListBean.clientList}" var="item" style="width:95%" styleClass="dataTable"
sortMode="multiple" paginator="true" rows="20" editable="true" sortOrder="descending"
draggableColumns="true" emptyMessage="No clients found with given search criteria"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" >
<p:column headerText="Last Name" filterBy="last_name" sortBy="last_name" style="width:auto; text-align:center" for="autocompl" >
<p:autoComplete id="autocompl" value="#{clientsListBean.text}" completeMethod="#{clientsListBean.lastNames}" />
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{item.last_name}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{item.last_name}" style="width:100%" />
</f:facet>
</p:cellEditor>
</p:column>
【问题讨论】:
标签: jsf-2 primefaces datatable