function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tech EnthuTech Enthu 

Help with row and column totals and displaying them on visualforce page when a cell value changes

How can I calculate row, column totals  dynamically and show them on the screen?

 

I have a visualforce page which is dynamically generated[based on soql results] with N number of rows and columns like matrix grid and now I would like to add a static summary row and column at the end to display the row and column summaries respectively. Summary values should be generated whenever there is change to any cell value and/or also whenever user adds or delete a row. Could you please guide me with some sample code for both apex and vf page to accomplish this task?

 

Thank you very much in advance for all your help.

 

 

PrabhaPrabha

you can achieve this with javascript/ jquery, or even apex code. I prefer javascript as we wont be needing to write the test cases again. 

 

look at it this way. 

if we are able to show something on the UI from database, salesforce will send it through a HTML id which will be unique through out the page. so, it doesn't matter like Dynamic/ or static the value will be having its on id like j_d0, j_d10 or something like that. if u can identify that with IE, view source u get the hold of the data. and then u can use looping in javascript to get the totals.

 

Remember to identify the HTML ID for the field. then VF is ur puppet.

 

HTH

Prabhan