$(document).ready(function() { $('#example').dataTable({ "sScrollX": "100%", // width of the table "sScrollXInner": "110%", //Width of the table's contents "bScrollCollapse": true, //When the displayed data is not large enough to support the table's default height, the vertical scroll bar is still displayed. (Default is false) "bPaginate": true, //whether pagination is displayed "bLengthChange": true, //Number of records displayed per page "bFilter": true, //search bar "bSort": true, //whether the sorting function is supported "bInfo": true, //Displays table information "bAutoWidth": false, //Adaptive width "aaSorting": [[1, "asc"]], //Sort the list, the first parameter represents the array (starting from 0). 1 indicates the Browser column. The second parameter is desc or asc "aoColumns": [ null, null, { "bVisible": true, //invisible "bSearchable": false, //participate in the search }, null, null ], // column settings, there are several columns in the table, and there are several items in the array "bStateSave": true, //Save state to cookie *************** is important, when the page is refreshed when searching, the search will disappear. This property can be avoided "sPaginationType": "full_numbers", //pagination, two styles, full_numbers and two_button (default) "oLanguage": { "sLengthMenu": "Show _MENU_ records per page", "sZeroRecords": "Sorry, no relevant data can be queried", "sInfo": "Currently displaying _START_ to _END_ for _TOTAL_ records", "sInfoEmtpy": "No data found", "sInfoFiltered": "A total of _MAX_ records in the data table)", "sProcessing": "Loading...", "sSearch": "search", "sUrl": "", //Multilingual configuration file, which allows you to put oLanguage settings in a txt file, e.g. Javascrip{filter}t/datatable/dtCH.txt "oPaginate": { "sFirst": "first page", "sPrevious": "Previous", "sNext": "Next", "sLast": "Last Page" } }, //Multilingual configuration "bJQueryUI": false, //You can add jqury's UI theme requires adding CSS "aLengthMenu": [[10, 25, 50, -1, 0], ["10 entries per page", "25 entries per page", "50 entries per page", "show all data", "do not show data"]] // Set the drop-down menu to display records per page }); }); Call the default settings directly
$('#example').dataTable();
|