How do I calculate column totals when pagination is enabled?

How do I calculate column totals when pagination is enabled?

twentyfivetwentyfive Posts: 3Questions: 0Answers: 0
edited May 2011 in DataTables 1.8
Hello,

My table is similar to this one: http://datatables.net/blog/Creating_beautiful_and_functional_tables_with_DataTables
where the last row in my table contains column totals. The difference in my case, however is that the totals are not static. Some cells allow the user to change cell's value via an input field, which in turn changes the total. I have a callback to handle this event, so that whenever an input's value is changed, the total is recalculated accordingly. The issue I'm having is that when using pagination, it only calculates the total of the rows that are displayed on screen (e.g. the ones on the current page), as opposed to all of the rows of the table. So I guess my question is, when using pagination, how can I retrieve all of the rows in the table?

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    There is the fnFooterCallback option which can be useful for that kind of thing, as shown here: http://datatables.net/examples/advanced_init/footer_callback.html

    Allan
This discussion has been closed.