This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15847|Reply: 0

[Bootstrap] Bootstrap Datatable is a simple basic configuration

[Copy link]
Posted on 11/2/2015 4:47:09 PM | | | |


$(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();





Previous:C# generates random numbers
Next:Jquery dataTable dynamically loads data for ajax requests
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com