Skip to content
Advertisement

How do I calculate the average of the TR column in the table?

I would like to calculate the average of “TR” column in my table, but I could not calculate it using jquery.

my jquery code:

JavaScript

Advertisement

Answer

You may access desired column data, using .column().data() method. If you need to recalculate your column average dynamically, based on visible rows, you may use selector modifier {search: 'applied'} as a second argument within .column() and option drawCallback to call average re-calculation upon each re-draw.

Please, checkout below demo of that approach:

JavaScript
JavaScript
Advertisement