Update the total according the field search

Update the total according the field search

otavio_laskosk_pcotavio_laskosk_pc Posts: 21Questions: 6Answers: 0

Hi,

I'm using only total like this:
https://datatables.net/examples/advanced_init/footer_callback.html
without the total per page.

I'would like to know how can I update the total according the field:

Ex.:
that is, the total should be of total pages that is appearing.

if i put a value in the field "search" it doesn't change.

Answers

  • kthorngrenkthorngren Posts: 21,300Questions: 26Answers: 4,945
    edited June 2018

    You should be able to use a selector-modifier, for example:

                // Total over all pages
                total = api
                    .column( 4, {search:'applied'} )
                    .data()
                .....
    

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    One issue with Kevin's {search: 'applied'} is that if the search results span several pages, all pages would be included in the total. You may want to use {page: 'current'} instead, which will only include what's displayed on the current page.

    Cheers,

    Colin

This discussion has been closed.