数据表中的复选框选择问题

时间:2015-02-15 05:55:23

标签: checkbox primefaces selection

我正在使用primeface 3.5,其中我有数据表和复选框列。在不同的列中我有一个数量的列,当我检查任何行时,我必须计算该数量的15%并在另一列显示结果。我的数据表是这样的:

<p:dataTable id="tblExamPaymentSlip" style="width:1200px;"
        value="#{examPaymentSlipMB.paymentSlipList}"
        selection="#{examPaymentSlipMB.tempList}" 
        rowIndexVar="rowsn" var="paymentSlip" rowKey="#{paymentSlip.paymentSlipId}" >
        <p:ajax event="rowSelectCheckbox"   listener="#{examPaymentSlipMB.addAmt}" process="tblExamPaymentSlip" update="dedId" />

        <p:column>
        <f:facet name="header">
                <h:outputText value="Payment" />
        </f:facet>
        <h:outputText   value="#{paymentSlip.offPaymentMasterModel.paymentAmount}" />
        </p:column>

        <p:column selectionMode="multiple" headerText="Tax"></p:column>
        <p:column>
            <f:facet name="header">
                    <h:outputText value="Deduction" />
            </f:facet>

            <f:facet name="output">
            <p:inputText id="dedId" value="#{paymentSlip.deductionAmt}" />
            </f:facet>

            </p:column>
       </p:dataTable>

Problem is that deduction amount is set in the model class but is not displayed in data table.My managed bean code is like this.

管理bean:

public void addAmt(SelectEvent event){

        ExamPaymentSlipModel obj =(ExamOfficialModel)event.getObject();

        for (ExamPaymentSlipModel examPaymentSlipModel : tempList) {
            if (obj.equals(examPaymentSlipModel)) {
                examPaymentSlipModel.setDeductionAmount((15*examPaymentSlipModel.getOffPaymentMasterModel().getPaymentAmount())/100);
            }
        }
     }

我如何显示金额?有人能帮忙吗。

0 个答案:

没有答案