Convert Figma logo to code with AI

wenzhixin logobootstrap-table

An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation, Vue.js)

11,726
4,440
11,726
201

Top Related Projects

Tables plug-in for jQuery

12,496

The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.

JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡

Build interactive dashboards in minutes.

24,859

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table

The Missing Javascript Datatable for the Web

Quick Overview

Bootstrap Table is a feature-rich jQuery plugin that provides a set of tools for creating and manipulating responsive, feature-rich tables. It is designed to work seamlessly with the popular Bootstrap CSS framework, making it easy to integrate into existing Bootstrap-based projects.

Pros

  • Responsive Design: Bootstrap Table automatically adjusts the table layout to fit different screen sizes, ensuring a consistent user experience across devices.
  • Customizable Features: The plugin offers a wide range of customizable features, such as sorting, pagination, search, and column resizing, allowing developers to tailor the table to their specific needs.
  • Extensive Documentation: The project has comprehensive documentation, including detailed examples and guides, making it easy for developers to get started and understand the available features.
  • Active Community: Bootstrap Table has a large and active community of contributors, ensuring ongoing support, bug fixes, and feature enhancements.

Cons

  • Dependency on jQuery: Bootstrap Table relies on the jQuery library, which may be a concern for developers who prefer to use modern JavaScript frameworks like React, Angular, or Vue.js.
  • Limited Functionality for Complex Tables: While Bootstrap Table is highly customizable, it may not be the best choice for building extremely complex tables with advanced features or integrations.
  • Potential Performance Issues: Depending on the size and complexity of the table, Bootstrap Table may experience performance issues, especially when dealing with large datasets.
  • Limited Accessibility Features: The plugin may not provide comprehensive accessibility features out of the box, which could be a concern for projects with strict accessibility requirements.

Code Examples

Initializing a Basic Table

$('#table').bootstrapTable({
  data: [
    { id: 1, name: 'Item 1', price: 10 },
    { id: 2, name: 'Item 2', price: 20 },
    { id: 3, name: 'Item 3', price: 30 }
  ]
});

This code initializes a basic table with three rows of data.

Enabling Pagination and Search

$('#table').bootstrapTable({
  pagination: true,
  search: true,
  data: [
    { id: 1, name: 'Item 1', price: 10 },
    { id: 2, name: 'Item 2', price: 20 },
    { id: 3, name: 'Item 3', price: 30 }
  ]
});

This code adds pagination and search functionality to the table.

Customizing Column Formatting

$('#table').bootstrapTable({
  columns: [
    { field: 'id', title: 'ID' },
    { field: 'name', title: 'Name' },
    {
      field: 'price',
      title: 'Price',
      formatter: function(value, row, index) {
        return '$' + value;
      }
    }
  ],
  data: [
    { id: 1, name: 'Item 1', price: 10 },
    { id: 2, name: 'Item 2', price: 20 },
    { id: 3, name: 'Item 3', price: 30 }
  ]
});

This code customizes the formatting of the "Price" column, adding a dollar sign to the values.

Getting Started

To get started with Bootstrap Table, follow these steps:

  1. Include the necessary CSS and JavaScript files in your HTML file:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.21.2/dist/bootstrap-table.min.css">

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://unpkg.com/bootstrap-table@1.21.2/dist/bootstrap-table.min.js"></script>
  1. Create a table element in your HTML:
<table id="table"
       data-toggle="table"
       data-pagination="true"

Competitor Comparisons

Tables plug-in for jQuery

Pros of DataTables

  • More extensive documentation and examples
  • Larger community and ecosystem of plugins
  • Advanced features like server-side processing and complex data manipulation

Cons of DataTables

  • Steeper learning curve for advanced features
  • Heavier file size, which may impact page load times
  • Less seamless integration with Bootstrap styling

Code Comparison

DataTables:

$(document).ready(function() {
    $('#myTable').DataTable({
        ajax: 'data.json',
        columns: [
            { data: 'name' },
            { data: 'position' },
            { data: 'office' }
        ]
    });
});

bootstrap-table:

$('#table').bootstrapTable({
    url: 'data.json',
    columns: [{
        field: 'name',
        title: 'Name'
    }, {
        field: 'position',
        title: 'Position'
    }, {
        field: 'office',
        title: 'Office'
    }]
});

Both libraries offer powerful table functionality, but DataTables provides more advanced features at the cost of complexity, while bootstrap-table focuses on simplicity and Bootstrap integration. The choice between them depends on project requirements and developer preferences.

12,496

The best JavaScript Data Table for building Enterprise Applications. Supports React / Angular / Vue / Plain JavaScript.

Pros of ag-grid

  • More advanced features like pivoting, grouping, and aggregation
  • Better performance with large datasets
  • Extensive enterprise-grade functionality

Cons of ag-grid

  • Steeper learning curve due to complexity
  • Requires a license for enterprise features
  • Larger file size and potential performance impact on initial load

Code Comparison

bootstrap-table:

<table data-toggle="table">
  <thead>
    <tr>
      <th>Item ID</th>
      <th>Item Name</th>
      <th>Item Price</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>Item 1</td>
      <td>$1</td>
    </tr>
  </tbody>
</table>

ag-grid:

const gridOptions = {
  columnDefs: [
    { field: 'itemId' },
    { field: 'itemName' },
    { field: 'itemPrice' }
  ],
  rowData: [
    { itemId: 1, itemName: 'Item 1', itemPrice: '$1' }
  ]
};

Both libraries offer powerful data grid solutions, but ag-grid provides more advanced features and better performance for complex use cases, while bootstrap-table offers a simpler, more lightweight option for basic table needs.

JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡

Pros of Handsontable

  • More advanced data manipulation features, including cell merging and complex formulas
  • Better performance with large datasets due to virtual rendering
  • Extensive API for programmatic control and customization

Cons of Handsontable

  • Steeper learning curve due to more complex configuration options
  • Larger file size, which may impact page load times
  • Commercial license required for some features and use cases

Code Comparison

Bootstrap-table basic initialization:

$('#table').bootstrapTable({
  columns: [{
    field: 'id',
    title: 'Item ID'
  }, {
    field: 'name',
    title: 'Item Name'
  }],
  data: [{id: 1, name: 'Item 1'}, {id: 2, name: 'Item 2'}]
});

Handsontable basic initialization:

const container = document.getElementById('example');
const hot = new Handsontable(container, {
  data: [{id: 1, name: 'Item 1'}, {id: 2, name: 'Item 2'}],
  columns: [{data: 'id', title: 'Item ID'}, {data: 'name', title: 'Item Name'}],
  rowHeaders: true,
  colHeaders: true
});

Both libraries offer powerful table functionality, but Handsontable provides more advanced features at the cost of complexity and potential licensing fees. Bootstrap-table is simpler to use and integrate, making it a good choice for basic table needs in Bootstrap-based projects.

Build interactive dashboards in minutes.

Pros of gridstack.js

  • Offers drag-and-drop functionality for creating dynamic grid layouts
  • Supports responsive design with mobile-friendly options
  • Provides more flexibility in terms of grid item sizing and positioning

Cons of gridstack.js

  • Steeper learning curve compared to bootstrap-table
  • Less focus on data presentation and tabular structures
  • May require more custom styling and configuration for complex layouts

Code Comparison

bootstrap-table example:

<table data-toggle="table">
  <thead>
    <tr>
      <th>Item ID</th>
      <th>Item Name</th>
      <th>Item Price</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>Item 1</td>
      <td>$1</td>
    </tr>
  </tbody>
</table>

gridstack.js example:

<div class="grid-stack">
  <div class="grid-stack-item" data-gs-x="0" data-gs-y="0" data-gs-width="4" data-gs-height="2">
    <div class="grid-stack-item-content">Item 1</div>
  </div>
  <div class="grid-stack-item" data-gs-x="4" data-gs-y="0" data-gs-width="4" data-gs-height="4">
    <div class="grid-stack-item-content">Item 2</div>
  </div>
</div>

Both libraries serve different purposes: bootstrap-table is primarily for creating responsive tables with advanced features, while gridstack.js is designed for building draggable and resizable grid layouts. The choice between them depends on the specific requirements of your project.

24,859

🤖 Headless UI for building powerful tables & datagrids for TS/JS - React-Table, Vue-Table, Solid-Table, Svelte-Table

Pros of TanStack Table

  • Framework-agnostic, supporting React, Vue, Solid, and vanilla JS
  • More flexible and customizable, allowing for complex table configurations
  • Better performance for large datasets due to virtualization support

Cons of TanStack Table

  • Steeper learning curve, especially for beginners
  • Requires more setup and configuration compared to Bootstrap Table
  • Less out-of-the-box styling options, may need additional CSS work

Code Comparison

Bootstrap Table:

<table data-toggle="table" data-url="data.json">
  <thead>
    <tr>
      <th data-field="id">ID</th>
      <th data-field="name">Name</th>
    </tr>
  </thead>
</table>

TanStack Table (React):

const table = useReactTable({
  data,
  columns,
  getCoreRowModel: getCoreRowModel(),
})

return (
  <table>
    {/* Table structure and rendering logic */}
  </table>
)

Summary

Bootstrap Table is simpler to set up and use, with built-in styling and features. It's ideal for quick implementations and basic table needs. TanStack Table offers more power and flexibility but requires more setup and coding. It's better suited for complex table requirements and applications needing high performance with large datasets.

The Missing Javascript Datatable for the Web

Pros of Datatable

  • Lightweight and fast, with minimal dependencies
  • Highly customizable with a rich API for advanced features
  • Modern design with smooth animations and interactions

Cons of Datatable

  • Smaller community and fewer extensions compared to Bootstrap Table
  • Less extensive documentation and examples
  • May require more custom coding for complex use cases

Code Comparison

Bootstrap Table:

<table data-toggle="table">
  <thead>
    <tr>
      <th>Item ID</th>
      <th>Item Name</th>
      <th>Item Price</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>Item 1</td>
      <td>$1</td>
    </tr>
  </tbody>
</table>

Datatable:

const datatable = new DataTable('#myTable', {
  columns: ['Item ID', 'Item Name', 'Item Price'],
  data: [
    [1, 'Item 1', '$1']
  ]
});

Both libraries offer easy-to-use table creation, but Datatable provides a more programmatic approach with its JavaScript API, while Bootstrap Table relies more on HTML attributes and data attributes for configuration.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Bootstrap Table

Build Status GitHub version Donate Backers on Open Collective Sponsors on Open Collective Package Quality

An extended Bootstrap table with radio, checkbox, sort, pagination, extensions and other added features.

To get started, check out:

List of donators

LICENSE

NOTE: Bootstrap Table is licensed under The MIT License. Completely free, you can arbitrarily use and modify this plugin. If this plugin is useful to you, you can Star this repo, your support is my biggest motive force, thanks.

Features

  • Created for Twitter Bootstrap (All versions supported)
  • Responsive web design
  • Scrollable Table with fixed headers
  • Fully configurable
  • Via data attributes
  • Show/Hide columns
  • Show/Hide headers
  • Show/Hide footers
  • Get data in JSON format using AJAX
  • Simple column sorting with a click
  • Format column
  • Single or multiple row selection
  • Powerful pagination
  • Card view
  • Detail view
  • Localization
  • Extensions

How to get it

Manual download

Use Releases page or the source.

Yarn

yarn add bootstrap-table

Npm

npm install bootstrap-table

CDN

You can source bootstrap-table directly from a CDN like CDNJS or bootcss or jsdelivr.

Contributing

For feature requests, bug reports or submitting pull requests, please ensure you first read CONTRIBUTING.md.

Reporting Issues

As stated above, please read CONTRIBUTING.md, especially Bug Reports

And as stated there, please provide an Online Example when creating issues!

It's really saves much time.

You can also use our examples template via Load Examples button:

Online Editor

Your feedback is very appreciated!

Acknowledgements

Thanks to everyone who have given feedback and submitted pull requests. A list of all the contributors can be found here. This project exists thanks to all the people who contribute. [Contribute].

Release History

Look at the Change Log

Local develop

To develop bootstrap-table locally please run:

mkdir bootstrap-table-dev
cd bootstrap-table-dev
git clone https://github.com/wenzhixin/bootstrap-table
git clone https://github.com/wenzhixin/bootstrap-table-examples

yarn add http-server
npx http-server

And then open: http://localhost:8081/bootstrap-table-examples

Local build

Be sure to use a current version of yarn/npm. To build bootstrap-table locally please run:

Yarn

yarn install
yarn build

Npm

npm install
npm run build

Result will appear in dist directory.

PayPal Sponsors

Write my essay services from Edubirdie

OpenCollective Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

OpenCollective Backers

Support this project by becoming a backer. Your image will show up here with a link to your website. [Become a backer]

NPM DownloadsLast 30 Days