Feature-Rich Data Table Plugin For Bootstrap 5/4/3/2

  • Posted on December 06, 2020
  • By Hossain Shahid

Bootstrap Table is a responsive, dynamic, extendable, multifunctional, and highly-customizable jQuery data table plugin for Bootstrap (5/4/3/2), Bulma, Foundation, Materialize, and Semantic frameworks.


  • Dynamic data rendering via AJAX.
  • Data filtering.
  • Data sorting.
  • Data editing.
  • Table pagination.
  • Show/hide specific columns.
  • Fixed table header.
  • Checkable table rows.
  • Expandable and collapsible table rows.
  • Allows to toggle between card view and detail view.
  • Exports data to JSON, XML, CSV, TXT, SQL, and Excel.
  • Useful extensions.
  • Tons of useful options, methods and events.
  • Supports 45+ languages.
  • 5 built-in themes: Bootstrap, Bulma, Foundation, Materialize, and Semantic.

Basic usage:

1. Include the Bootstrap Table plugin's files and extensions of your choice in your Bootstrap project.

<!-- Dependencies -->
<link rel="stylesheet" href="/path/to/bootstrap.min.css">
<script src="/path/to/jquery.min.js"></script>
<script src="/path/to/bootstrap.min.js"></script>
<!-- Bootstrap Table Plugin -->
<link rel="stylesheet" href="bootstrap-table.css">
<script src="bootstrap-table.js"></script>
<!-- Bulma Theme -->
<link rel="stylesheet" href="thems/bulma/bootstrap-table-bulma.css">
<script src="thems/bulma/bootstrap-table-bulma.js"></script>
<!-- Foundation Themes -->
<link rel="stylesheet" href="thems/bulma/bootstrap-table-foundation.css">
<script src="thems/bulma/bootstrap-table-foundation.js"></script>
<!-- Materialize Themes -->
<link rel="stylesheet" href="thems/bulma/bootstrap-table-materialize.css">
<script src="thems/bulma/bootstrap-table-materialize.js"></script>
<!-- Semantic Themes -->
<link rel="stylesheet" href="thems/bulma/bootstrap-table-semantic.css">
<script src="thems/bulma/bootstrap-table-semantic.js"></script>

2. Include the Bootstrap Table plugin's extensions:

<!-- use the query params in the address bar  -->
<script src="extensions/addrbar/bootstrap-table-addrbar.js"></script>

<!-- auto refresh table  -->
<script src="extensions/auto-refresh/bootstrap-table-auto-refresh.js"></script>

<!-- enable cookies  -->
<script src="extensions/cookie/bootstrap-table-cookie.js"></script>

<!-- allows you to copy table rows  -->
<script src="extensions/copy-rows/bootstrap-table-copy-rows.js"></script>

<!-- custom table view  -->
<script src="extensions/custom-view/bootstrap-table-custom-view.js"></script>

<!-- use data-defer-url instead of data-url  -->
<script src="extensions/defer-url/bootstrap-table-defer-url.js"></script>

<!-- editable table  -->
<script src="extensions/editable/bootstrap-table-editable.js"></script>

<!-- exports table data to 'json', 'xml', 'csv', 'txt', 'sql', 'excel', etc  -->
<script src="extensions/export/bootstrap-table-export.js"></script>

<!-- enables filter controls  -->
<link rel="stylesheet" href="extensions/filter-control/bootstrap-table-filter-control.css">
<script src="extensions/filter-control/bootstrap-table-filter-control.js"></script>

<!-- makes table columns fixed  -->
<link rel="stylesheet" src="extensions/fixed-columns/bootstrap-table-fixed-columns.css">
<script src="extensions/fixed-columns/bootstrap-table-fixed-columns.js"></script>

<!-- groups the data by the field  -->
<link rel="stylesheet" src="extensions/group-by-v2/bootstrap-table-group-by.css">
<script src="extensions/group-by-v2/bootstrap-table-group-by.js"></script>

<!-- enhanced i18n support  -->
<script src="extensions/i18n-enhance/bootstrap-table-i18n-enhance.js"></script>

<!-- enables key events  -->
<script src="extensions/key-events/bootstrap-table-key-events.js"></script>

<!-- responsive & mobile friendly table view  -->
<script src="extensions/mobile/bootstrap-table-mobile.js"></script>

<!-- enables multi-sort  -->
<script src="extensions/multiple-sort/bootstrap-table-multiple-sort.js"></script>

<!-- allows to jump to a specific page  -->
<link rel="stylesheet" href="extensions/page-jump-to/bootstrap-table-jump-to.css"></style>
<script src="extensions/page-jump-to/bootstrap-table-jump-to.js"></script>

<!-- pipeline  -->
<script src="extensions/pipeline/bootstrap-table-pipeline.js"></script>

<!-- print  -->
<script src="extensions/print/bootstrap-table-print.js"></script>

<!-- reorder table via drag and drop  -->
<link rel="stylesheet" href="dragtable.css">
<script src="jquery-ui.js"></script>
<script src="jquery.dragtable.js"></script>
<script src="extensions/reorder-columns/bootstrap-table-reorder-columns.js"></script>

<!-- allows to reorder table rows  -->
<link rel="stylesheet" href="bootstrap-table-reorder-rows.css">
<script src="jquery.tablednd.js"></script>
<script src="extensions/reorder-rows/bootstrap-table-reorder-rows.js"></script>

<!-- resizable table  -->
<script src="extensions/resizable/bootstrap-table-resizable.js"></script>

<!-- sticky table header  -->
<script src="extensions/sticky-header/bootstrap-table-sticky-header.js"></script>

<!-- enables toolbar  -->
<script src="extensions/toolbar/bootstrap-table-toolbar.js"></script>

<!-- enables tree <a href="https://www.jqueryscript.net/tags.php?/grid/">grid</a>  -->
<script src="extensions/treegrid/bootstrap-table-treegrid.js"></script>

3. Load languages you prefer. You can find all languages under the local folder.

<script src="locale/bootstrap-table-en-US.min.js"></script>

4. Turns a standard HTML table into a data table using the data-toggle="table" attribute.

<table class="table" data-toggle="table">
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>
      <td>the Bird</td>
      <td>@<a href="https://www.jqueryscript.net/tags.php?/twitter/">twitter</a></td>

5. To load tabular data from an external JSON file:

<table class="table" data-toggle="table" data-url="data.json">
      <th scope="col">First</th>
      <th scope="col">Last</th>
      <th scope="col">Handle</th>

6. You can also initialize the data table and define the tabular data in the JavaScript as these

  columns: [{
      field: 'first',
      title: 'First Name'
  }, {
      field: 'last',
      title: 'Last Name'
  }, {
      field: 'handle',
      title: 'Handle'
  data: [{
      first: 'Mark',
      last: 'Otto',
      handle: '@mdo'

7. Full plugin options to customize your data table.


  // height
  height: undefined,

  // table classes
  classes: 'table table-hover',

  // add custom buttons to the button bar
  buttons: {},

  // thead classes
  theadClasses: '',

  // header style
  headerStyle: function headerStyle(column) {
    return {};

  // undefined text
  undefinedText: '-',

  // local file
  locale: undefined,

  // enables virtual scroll
  virtual<a href="https://www.jqueryscript.net/tags.php?/Scroll/">Scroll</a>: false,
  virtualScrollItemHeight: undefined,

  // enable sortable
  sortable: true,

  // enable silent sort
  silentSort: true,

  // enable stable sort
  sortStable: false,

  // class name of sortable cell
  sortClass: undefined,

  // custom sort name
  sortName: undefined,

  // or desc
  sortOrder: 'asc',

  // reset the sort on third click
  sortReset: false,

  // remember order direction
  rememberOrder: false,

  // enable server-side sort
  serverSort: true,

  // striped rows
  striped: false,

  // custom sort function
  customSort: $.noop,

  // table columns
  columns: [[]],

  // tabular data
  data: [],

  // filter options
  filterOptions: {
    filterAlgorithm: 'and'

  // total field
  totalField: 'total',

  // total not filtered
  totalNotFilteredField: 'totalNotFiltered',

  // data field
  dataField: 'rows',

  // support server side pagination
  footerField: 'footer',

  // AJAX options
  url: undefined,
  method: 'get',
  ajax: undefined,
  cache: true,
  contentType: 'application/json',
  dataType: 'json',
  ajaxOptions: {},
  queryParams: function (params) {
      return params;
  queryParamsType: 'limit', // undefined
  responseHandler: function (res) {
      return res;

  // pagination options
  pagination: false,
  onlyInfoPagination: false,
  showExtendedPagination: false,
  paginationLoop: true,
  sidePagination: 'client', // client or server
  totalRows: 0, // server side need to set
  totalNotFiltered: 0,
  pageNumber: 1,
  pageSize: 10,
  pageList: [10, 25, 50, 100],
  paginationHAlign: 'right', //right, left
  paginationVAlign: 'bottom', //bottom, top, both
  paginationDetailHAlign: 'left', //right, left
  paginationPreText: '&lsaquo;',
  paginationNextText: '&rsaquo;',
  paginationSuccessivelySize: 5, // Maximum successively number of pages in a row
  paginationPagesBySide: 1, // Number of pages on each side (right, left) of the current page.
  paginationUseIntermediate: false, // Calculate intermediate pages for quick access
  showPaginationSwitch: false,

  // live search options
  search: false,
  searchHighlight: false,
  searchOnEnterKey: false,
  strictSearch: false,
  searchSelector: false,
  searchAlign: 'right',
  visibleSearch: false
  showButtonIcons: true,
  showButtonText: false,
  showSearchButton: false,
  showSearchClearButton: false,
  trimOnSearch: true,
  searchTimeOut: 500,
  searchText: '',
  customSearch: $.noop,
  searchAccentNeutralise: false,

  // name of radio or checkbox input
  selectItemName: 'btSelectItem',

  // show table header
  showHeader: true,

  // show table footer
  showFooter: false,

  // show specific columns
  showColumns: false,

  // show toggle all
  showColumnsToggleAll: false,

  // shows column search field
  showColumnsSearch: false,

  // show refresh button
  showRefresh: false,

  // show toggle button (card view & detail view)
  showToggle: false,

  // show fullscreen button
  showFullscreen: false,

  // auto display card view
  smartDisplay: true,

  // escape a string for insertion into HTML
  escape: false,

  // minimum number of columns to hide from the columns drop down list.
  minimumCountColumns: 1,

  // which field is an identity field
  idField: undefined,

  // unique identifier for each row
  uniqueId: undefined,

  // enable card view
  cardView: false,

  // detail view
  detailView: false,
  detailFormatter: function (index, row) {
    return '';
  detailFilter: function (index, row) {
    return true;
  detailViewIcon: true,
  detailViewByClick: false,
  detailViewAlign: 'left',

  // click to select
  clickToSelect: false,

  // enable single select
  singleSelect: false,

  // toolbar options
  toolbar: undefined,
  toolbarAlign: 'left',
  buttonsPrefix: null,
  buttonsToolbar: undefined,
  buttonsAlign: 'right',
  buttonsOrder: ['paginationSwitch', 'refresh', 'toggle', 'fullscreen', 'columns'],
  checkboxHeader: true,

  // maintain meta data
  maintainMetaData: true,

  // enable multi-row selection
  multipleSelectRow: false,

  // maintain selected
  maintainSelected: false,

  // icon size
  iconSize: undefined,

  // button class
  buttonsClass: bs.buttonsClass,

  // prefix
  iconsPrefix: bs.iconsPrefix, // glyphicon or fa (font awesome)

  // icons
  icons: bs.icons,

  // return true if the click should be ignored
  // false if the click should cause the row to be selected
  ignoreClickToSelectOn: function (element) {
    return $.inArray(element.tagName, ['A', 'BUTTON']);

  // row style
  rowStyle: function (row, index) {
    return {};

  // row attributes
  rowAttributes: function (row, index) {
    return {};

  // footer style
  footerStyle: function (row, index) {
    return {};

  // font size of the loading text
  loadingFontSize: 'auto',

  // custom loading template
  loadingTemplate: function loadingTemplate(loadingMessage) {
    return "<span class=\"loading-wrap\">\n      <span class=\"loading-text\">".concat(loadingMessage, "</span>\n      <span class=\"animation-wrap\"><span class=\"animation-dot\"></span></span>\n      </span>\n    ");


8. Customize columns with the following options.

    field: undefined,
    title: undefined,
    title<a href="https://www.jqueryscript.net/tooltip/">Tooltip</a>: undefined,
    'class': undefined,
    width: undefined,
    widthUnit: 'px',
    rowspan: undefined,
    colspan: undefined,
    align: undefined,
    // left, right, center
    halign: undefined,
    // left, right, center
    falign: undefined,
    // left, right, center
    valign: undefined,
    // top, middle, bottom
    cellStyle: undefined,
    radio: false,
    checkbox: false,
    checkboxEnabled: true,
    clickToSelect: true,
    showSelectTitle: false,
    sortable: false,
    sortName: undefined,
    order: 'asc',
    // asc, desc
    sorter: undefined,
    visible: true,
    switchable: true,
    cardVisible: true,
    searchable: true,
    formatter: undefined,
    footerFormatter: undefined,
    detailFormatter: undefined,
    searchFormatter: true,
    searchHighlightFormatter: false,
    escape: false,
    events: undefined

9. You can also pass the options via data-OPTION attributes as these:

<table id="table"
   data-page-list="[10, 25, 50, 100, ALL]"
      <th data-field="id" data-halign="right" data-align="center">Item ID</th>
      <th data-field="name" data-halign="center" data-align="left">Item Name</th>
      <th data-field="price" data-halign="left" data-align="right">Item

10. Callback functions and event handlers.

$('#example').on('eventName.bs.table', function (e, arg1, arg2, ...) {
  // ...

// or 

  onAll: function onAll(name, args) {
    return false;
  onClickCell: function onClickCell(field, value, row, $element) {
    return false;
  onDblClickCell: function onDblClickCell(field, value, row, $element) {
    return false;
  onClickRow: function onClickRow(item, $element) {
    return false;
  onDblClickRow: function onDblClickRow(item, $element) {
    return false;
  onSort: function onSort(name, order) {
    return false;
  onCheck: function onCheck(row) {
    return false;
  onUncheck: function onUncheck(row) {
    return false;
  onCheckAll: function onCheckAll(rows) {
    return false;
  onUncheckAll: function onUncheckAll(rows) {
    return false;
  onCheckSome: function onCheckSome(rows) {
    return false;
  onUncheckSome: function onUncheckSome(rows) {
    return false;
  onLoadSuccess: function onLoadSuccess(data) {
    return false;
  onLoadError: function onLoadError(status) {
    return false;
  onColumnSwitch: function onColumnSwitch(field, checked) {
    return false;
  onPageChange: function onPageChange(number, size) {
    return false;
  onSearch: function onSearch(text) {
    return false;
  onToggle: function onToggle(cardView) {
    return false;
  onPreBody: function onPreBody(data) {
    return false;
  onPostBody: function onPostBody() {
    return false;
  onPostHeader: function onPostHeader() {
    return false;
  onPostFooter: function onPostFooter() {
    return false;
  onExpandRow: function onExpandRow(index, row, $detail) {
    return false;
  onCollapseRow: function onCollapseRow(index, row) {
    return false;
  onRefreshOptions: function onRefreshOptions(options) {
    return false;
  onRefresh: function onRefresh(params) {
    return false;
  onResetView: function onResetView() {
    return false;
  onScrollBody: function onScrollBody() {
    return false;

Self Employee

Hossain Shahid


You May Also Like