Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide "Showing 1 of N Entries" with the dataTables.js library

How do you remove the "Showing 1 of N entries" line of text on a dataTable (that is when using the javascript library dataTables? I think I was looking for something along these lines...

 $('#example').dataTable({
      "showNEntries" : false
       });

Pretty sure this is a simple one, but cannot seem to find it in the docs.

like image 943
nickL Avatar asked Oct 17 '13 22:10

nickL


People also ask

Are DataTables free?

DataTables is free, open source software that you can download and use for whatever purpose you wish, on any and as many sites you want. It is free for you to use!

What is the use of DataTables?

A DataSet is made up of a collection of tables, relationships, and constraints. In ADO.NET, DataTable objects are used to represent the tables in a DataSet. A DataTable represents one table of in-memory relational data; the data is local to the .


3 Answers

You can remove it with the bInfo option (http://datatables.net/usage/features#bInfo)

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

Update: Since Datatables 1.10.* this option can be used as info, bInfo still works in current nightly build (1.10.10).

like image 111
BMH Avatar answered Oct 08 '22 19:10

BMH


try this for hide

$('#table_id').DataTable({
  "info": false
});

and try this for change label

$('#table_id').DataTable({
 "oLanguage": {
               "sInfo" : "Showing _START_ to _END_ of _TOTAL_ entries",// text you want show for info section
            },

});
like image 33
mamal Avatar answered Oct 08 '22 19:10

mamal


If you also need to disable the drop-down (not to hide the text) then set the lengthChange option to false

$('#datatable').dataTable( {
  "lengthChange": false
} );

Works for DataTables 1.10+

Read more in the official documentation

like image 9
Arian Acosta Avatar answered Oct 08 '22 19:10

Arian Acosta