Search code examples
phpjqueryajaxfootable

How to display total number of rows in FooTable?


I am pushing data into FooTable via Ajax. I refresh all rows on each AJAX call by using this code,

$('.footable tbody').html(outData[1]).trigger('footable_redraw');

I want to show total number of rows in the table, as well as start and end rows in the current page in footer area.

For example,

View 1-30 of 90631 Products

I checked documentation of FooTable, but didn't found anything relevant.

I got the total number of length by using this code,

$("tbody tr").length

How can I get start and end row numbers as I am using pagination in Footable?


Solution

  • You can count number of tr (which means row) tags in your table body :

    $("tbody tr").length
    

    Here example : http://jsfiddle.net/RomanGroovyDev/5Ntye/18/