gpt4 book ai didi

Primefaces 对要在页脚中显示的特定列求和

转载 作者:行者123 更新时间:2023-12-05 02:19:45 26 4
gpt4 key购买 nike

我在我的应用程序中使用 PrimeFaces 6.0。我使用我的页面之一,如银行 challan。如果用户有类型计数来计算金额和总金额。

<p:column headerText="Denomination">
<h:outputText value="#{bank.denominationAmt}"/>
</p:column>
<p:column headerText="Count">
<p:inputText value="#{bank.count}"/>
</p:column>
<p:column headerText="Amount">
<p:inputText value="#{bank.amt}"/>
</p:column>
....

我需要用户输入 count 或 amount 到 javascript 或 primefaces 以显示在 footerText 中显示的金额总和是可能的吗?

最佳答案

您必须计算托管 bean 中的总数,然后在页脚中添加一个 columnGroup 以显示它们:

<p:columnGroup type="footer">
<p:row>
<p:column style="text-align:right" footerText="Totals:" />
<p:column style="text-align:right" footerText="#{managedBean.amount}" />
...
...
</p:row>
</p:columnGroup>

您需要在金额输入文本中设置带有更改事件的p:ajax 以重新计算金额总和并更新总计列。

关于Primefaces 对要在页脚中显示的特定列求和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41818690/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com