How to get filtered row count

后端 未结 1 512
粉色の甜心
粉色の甜心 2021-01-12 07:38

I have been trying to get the row count of my table after filtering, but I can\'t even get it to respond back with the row count initially.

My table is rendered via

相关标签:
1条回答
  • 2021-01-12 07:48

    Use page.info() API method to get paging information about the table.

    It returns an object, for example:

    {
        "page": 1,
        "pages": 6,
        "start": 10,
        "end": 20,
        "length": 10,
        "recordsTotal": 57,
        "recordsDisplay": 57
    }
    

    Usage:

    function getNumFilteredRows(id){
       var info = $(id).DataTable().page.info();
       return info.recordsDisplay;
    }
    
    0 讨论(0)
提交回复
热议问题