I am using primeface 3.5 where I have datatable with check box column.Among different columns i have a column with amount and when i check any row then i have to calculate 15% of that amount and show the result in another column .My data table is like this:
<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.
Managed 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);
}
}
}
How can i display the amount ? Can any one help with this.
Aucun commentaire:
Enregistrer un commentaire