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');
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?
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.
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.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With