用filterBy
筛选后,var
实例丢失
<p:dataTable id="searchResults"
var="searchResult"
value="#{employeeController.searchResults}"
selectionMode="single"
selection="#{employeeController.selectedEmployee}"
rowKey="#{searchResult.id}">
<p:column headerText="Employee Name"
filterBy="#{searchResult.name}"
sortBy="#{searchResult.name}">
<h:outputText value="#{searchResult.name}"/>
</p:column>
</p:dataTable>
<p:commandButton actionListener="#{employeeController.editEmployee(searchResult)}"
icon="ui-icon-pencil"
title="Güncelle" ajax="true" update="@form">
我的事件没有得到选定的searchResult
实例,而是一个null
值
我解决了这个问题。我刚好漏掉了filteredValue