Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide LengthMenu from Jquery datatable

Tags:

Please how do I hide the LengthMenu (the dropdownlist that displays number of records being shown per page) from my Jquery datatable?

Currently I am able to disable it, but I do not want it to appear at all. See my Fiddle here below:-

testdata = [{"id":"58","country_code":"UK"},{"id":"59","country_code":"US"}]; $('#test').dataTable({     "aaData": testdata,     "aoColumns": [         { "mDataProp": "id" },         { "mDataProp": "country_code" }     ],     "bLengthMenu" : false, //thought this line could hide the LengthMenu     "bInfo":false,     }); `//the next 2 lines disables the LengthMenu //var aLengthMenu = $('select[name=test_length]'); //$(aLengthMenu).prop('display', 'disabled'); 
like image 791
Sola Oderinde Avatar asked Nov 12 '13 12:11

Sola Oderinde


People also ask

How many times has the lengthmenu been viewed in jQuery?

Viewed45k times 25 2 Please how do I hide the LengthMenu (the dropdownlist that displays number of records being shown per page) from my Jquery datatable?

What is the use of lengthmenu in DataTable?

The DataTable also exposes a powerful API that can be further used to modify how the data is displayed. The lengthMenu option is used to specify the options that are available in the drop-down list that controls the number of rows that a single page will have when pagination is enabled.

What is DataTable in jQuery?

DataTables is jQuery plugin that can be used for adding interactive and advanced controls to HTML tables for the webpage. This also allows the data in the table to be searched, sorted, and filtered according to the needs of the user. The DataTable also exposes a powerful API that can be further used to modify how the data is displayed.

What is the display length parameter for in DataTables?

This parameter allows you to readily specify the entries in the length drop down select list that DataTables shows when pagination is enabled. It can be either: 1D array of integer values which will be used for both the displayed option and the value to use for the display length, or


1 Answers

Try with

$('#test').dataTable({     "aaData": testdata,     "aoColumns": [         { "mDataProp": "id" },         { "mDataProp": "country_code" },         { "mDataProp": "title" },         { "mDataProp": "pubdate" },         { "mDataProp": "url" }     ],     "bLengthChange" : false, //thought this line could hide the LengthMenu     "bInfo":false,     }); 

Fiddle

like image 125
Sridhar R Avatar answered Oct 03 '22 08:10

Sridhar R