我正在尝试使用以下命令更新页面的一部分:
$('.myDatePicker').datetimepicker({
timepicker : false,
closeOnDateSelect : true,
format : 'd-m-Y',
scrollMonth : false,
scrollInput : false
});
单击此按钮时,我需要更新包含此按钮的面板。
panelGroup:
<p:commandButton id="deleteDirectPaymentLine-#{counter.index}"
icon="fa fa-close Fs16 white"
action="#{step.deleteDirectPaymentLine(directPaymentLine)}"
process="@all"
rendered="#{directPayment.getDirectPaymentLineSet().size() gt 1}"
update="listDirectPaymentLines, container, totalAmount"
immediate="true"
ajax="false" />
从命令按钮调用的Delete方法如下:
<h:panelGroup id="listDirectPaymentLines">
<c:forEach var="directPaymentLine" items="#{step.directPaymentLineList}" varStatus="counter">
<r:propertyRow>
<r:property id="costType-#{counter.index}" width="HALF" label="Cost Type" value="#{directPaymentLine.claimCostType}"
objectList="#{entityListCache.getAllClaimCostTypes(entityInstance.costType, claim)}"
onChangeActionObject="#{step}" onChangeActionMethod="changeDirectPaymentLine"
reRenderPropertiesOnChange="totalAmount, claimDeductible-#{counter.index}, deductibleInRespectOfClaim-#{counter.index}"
hideNoSelectionLabel="false" required="true" />
<c:if test="#{!step.hasCoinsurance}">
<r:property id="amount-#{counter.index}" width="QUARTER" label="Amount" value="#{directPaymentLine.amount}"
onChangeActionObject="#{step}" onChangeActionMethod="changeDirectPaymentLine"
reRenderPropertiesOnChange="totalAmount" required="true" />
</c:if>
<r:property id="deleteButton-#{counter.index}" type="CUSTOM">
<p:commandButton id="deleteDirectPaymentLine-#{counter.index}"
icon="fa fa-close Fs16 white"
action="#{step.deleteDirectPaymentLine(directPaymentLine)}"
process="@all"
rendered="#{directPayment.getDirectPaymentLineSet().size() gt 1}"
update="listDirectPaymentLines, container, totalAmount"
immediate="true"
ajax="false" />
</r:property>
<c:if test="#{step.hasCoinsurance}">
<r:propertyRow>
<r:property width="HALF" id="hundredPercentAmount-#{counter.index}" label="100% Amount" value="#{directPaymentLine.oneHundredPercentAmount}"
onChangeActionObject="#{step}" onChangeActionMethod="changeHundredPercentAmount"
reRenderPropertiesOnChange="totalAmount, totalHundredPercentAmount, amount-#{counter.index}" />
<r:property width="HALF" id="amount-#{counter.index}" label="Our Share Amount" value="#{directPaymentLine.amount}"
onChangeActionObject="#{step}" onChangeActionMethod="changeDirectPaymentLine"
reRenderPropertiesOnChange="totalAmount, totalHundredPercentAmount, hundredPercentAmount-#{counter.index}" />
</r:propertyRow>
</c:if>
</r:propertyRow>
<r:propertyRow>
<r:property width="HALF" label="Claim deductible" id="claimDeductible-#{counter.index}" value="#{directPaymentLine.claimDeductible}"
objectList="#{step.getClaimDeductibles(directPaymentLine)}"
rendered ="#{step.isRenderClaimDeductible(directPaymentLine)}"
displayProperty="amountDisplayDescription"
onChangeActionObject="#{step}" onChangeActionMethod="changeDirectPaymentLine"
hideNoSelectionLabel="false" required="true" />
<r:property label="Deductible In Respect of" id="deductibleInRespectOfClaim-#{counter.index}" value="#{directPaymentLine.deductibleInRespectOf}"
width="HALF"
objectList="#{entityListCache.getAllDeductibleInRespectOfs(directPaymentLine.deductibleInRespectOf)}"
rendered="#{step.isRenderClaimDeductible(directPaymentLine)}"
onChangeActionObject="#{step}" onChangeActionMethod="changeDirectPaymentLine"
hideNoSelectionLabel="false" required="true" />
</r:propertyRow>
</c:forEach>
有人知道为什么面板没有更新? 当我调试删除方法时,我可以看到正确的对象被删除但它没有在视图中更新。如果我删除列表的最后一个元素,正常工作,但如果我删除其他内容,则删除另一行。 例如:
删除对象4时,新列表仅包含前3个元素。但是如果删除了对象3或2,则会再次删除最后一行,但仅在视图中删除。
需要一些人来强制使用新值来更新panelGroup。