Boss
Boss

Reputation: 473

not able to display record count in data table

I have used jquery data table plug in for showing my data. I want to show the record count at the bottom of my data table. please anyone help me how to do it?

 $('.data-table').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
            "sDom": '<"dt_head"fp>t<"F"l>'
});

Upvotes: 2

Views: 2574

Answers (4)

Rajesh
Rajesh

Reputation: 96

In your sDom parameter there is an option 'i' for showing record count.suppose if you want to show record count in footer add like below

  "sDom": '<"dt_head"fp>t<"F"il>'

Upvotes: 2

Mayank Pathak
Mayank Pathak

Reputation: 3681

You should have search it on Datatable.net itself. You can easily get many references from there.

The one i found to work is

oTable.fnGetData().length

Also check their API documentation for more information.

Upvotes: 2

Roy M J
Roy M J

Reputation: 6948

You need not add any defaults to jquery datatable declaration. By default it will display summary, search, sort and so on.

Consider table id is kalyan

then just use :

kalyan = $('#kalyan').datatable();

If you want to use a custom one on your own then :

kalyan.fnSettings().fnRecordsTotal() //should do it.

kalyan.fnSettings().fnRecordsDisplay() //will give you the number after filtering has occurred.

Cheers

Upvotes: 1

Eswara Reddy
Eswara Reddy

Reputation: 1647

Include this option at the time of initializing your datatable

$('#example').dataTable( {
    "bInfo": true
});

Upvotes: 3

Related Questions