+ Start a Discussion
anup ramanup ram 

Pageblocktable calculate sum of column

Hi

 

I have a pageblocktable with some fields like price , user editable Price field, and total amount field ( quantity * price)

 

i have to calculate the grandtotal i.e total of totalamount field in every row .

 

This grandtotal has to be displayed on the page and also should be available for subsequent operations.

 

How to do this.

 

Please share a sample code .

JohnSchultzJohnSchultz

Your controller or extension could loop through the data and calculate the total, which it could then make available through to the VF page through a getter method.

 

Other than that, I don't know of any native Visualforce functionality that could do the calculation on the fly.