为什么在这个例子中不能更新单行?
<h:form id="validateFormId">
<p:dataTable var="elementVal" value="#{testController.players}"
id="dataTableId" binding="#{dataTableB}"
selection="#{testController.selectedPlayers}"
rowKey="#{elementVal.playerId}" rowIndexVar="idx">
<p:column>
<h:outputText value="#{elementVal.playerName}"/>
</p:column>
<p:column>
<p:commandButton value="test" process="@this" update=":validateFormId:dataTableId:@row(#{idx})" action="#{testController.triggerElement('ac', elementVal, idx, dataTableB)}"/>
</p:column>
<p:column>
<p:autoComplete id="fieldA"
value="#{elementVal.playerPosition}"
completeMethod="#{autocompleteController.loadSuggestedValues}"
var="val" itemValue="#{val}" itemLabel="#{val}"
autoHighlight="false" dropdown="true" my="left bottom"
at="left top"
forceSelection="true">
<p:column>
#{val}
</p:column>
<p:ajax event="change" process="@this" update=":validateFormId:dataTableId:@row(#{idx})"
listener="#{testController.triggerElement('ac', elementVal, idx, dataTableB)}" />
<p:ajax event="itemSelect" process="@this" update=":validateFormId:dataTableId:@row(#{idx})"
listener="#{testController.triggerElement('ai', elementVal, idx, dataTableB)}" />
</p:autoComplete>
</p:column>
</p:dataTable>
</h:form>
当perst“test”按钮时,bean更改playerName,但不更新行。 尝试使用primefaces选择器和omnifaces ajax。
public void triggerElement(String event, Player element, int idx, UIData table) {
System.out.println("trigger event: " + event);
System.out.println("item: " + element.getPlayerId());
System.out.println("value: " + element.getPlayerName());
element.setPlayerName(element.getPlayerName() + "1");
Ajax.updateRow(table, idx);
}
primefaces 5.3,omnifaces 2.6.4
答案 0 :(得分:0)
@row
搜索表达式未在primefaces 5.3中实现,你必须使用primefaces 6.2 +