totalListSumA是java内的ArrayList。在调试模式下,arraylist工作正常。新值分配到此列表中。
当用户在框中输入新值时,程序将重新计算新的总和并显示在下面显示的代码中。
<p:inputNumber
class="caseType1"
rendered="#{inputFormTemplateView.allowEdit}"
inputStyle="text-align: center"
minValue="0"
maxValue="99999999"
decimalPlaces="0"
thousandSeparator=""
emptyValue=""
value="#{inputFormView.selectedInputFormDetail.data[dataField]}" >
<p:ajax update="dataField, #{inputForm4_1View.getColTotal()}"/>
<p:ajax update="@(.totalRow3)"></p:ajax>
</p:inputNumber>
<tr>
<td align='center'>Total</td>
<p:repeat var="item" value="#{inputForm4_1View.totalListSumA}" class="totalRow3">
<td class="cell_cal" style='text-align:center;' >
<h:outputLabel
class="totalRow3"
value="#{item}" />
</td>
</p:repeat>
</tr>
我尝试过
仍然在p:repeat中该值保持不变。我可以尝试获取并显示totalListSumA中最新值的任何方法吗?
这是错误的
<p:ajax update="dataField, #{inputForm4_1View.getColTotal()}"/>
<p:ajax update="@(.totalRow3)"></p:ajax>
1)Ajax应该具有event =“ change”或其他事件,但是最错误的是在update内部调用bean方法。
2)使用listener="#{inputForm4_1View.getColTotal()}"
3)不要使用2个相同的ajax。
解决方案:
<p:ajax event="change" update="dataField, @(.totalRow3)" listener="#{inputForm4_1View.getColTotal()}"/>
如果这不能解决您的问题,请尝试更新update="@form"
或update="yourFormId"
之类的表格