react-bootstrap-table 0,4,0,2,4,0 eslint travis-ci gulp npm

It's a react table for bootstrap

react-bootstrap-table

Join the chat at https://gitter.im/AllenFang/react-bootstrap-table

NPM version Build Status

Dependency Status devDependency Status peerDependency Status

It’s a react.js table for bootstrap, named reactbsTable. It’s a configurable, functional table component and make you build a Bootstrap Table more efficiency and easy in your React application, However react-bootstrap-table support these features:

  • striped, borderless, condensed table
  • column align, hidden, width, sort
  • scrolling table
  • cell format
  • pagination
  • row selection
  • column filter with multi type
  • cell edit with multi type editor
  • insert & delete Row
  • row and column style customization
  • global search
  • export to CSV file
  • rich function hooks
  • large columns table

Explore more example on examples folder
See more about react-bootstrap-table.
Check this for more advance usage for react-bootstrap-table. Feel free to ask more examples.
Check the CHANGELOG for more detail release notes.

Notes

v2.0.0 has been released, the main patches are fixing the unalign or wrong size column on different browsers and improving the table structure. Please check this for more detail explanation.

After v2.4.4, we move the css files to dist folder for allowing this repo can be hosted on cdnjs

v3.0.0 is under planning, check Milestone to v3.0.0.

Development

react-bootstrap-table dependencies on react 0.14.x and Bootstrap 3 written by ES6 and use gulp and browserify for building and bundling.

You can use the following commands to prepare development

$ git clone https://github.com/AllenFang/react-bootstrap-table.git
$ cd react-bootstrap-table
$ npm install

Use gulp to build the react-bootstrap-table

$ gulp dev  #for development
$ gulp example-server #see all examples, go to localhost:3004
$ gulp prod #for production

Usage

a.Install

npm install react-bootstrap-table --save

b.Import Module

To use react-bootstrap-table in your react app, you should import it first. You can do this in two ways:

With a module bundler

With a module bundler like webpack that supports either CommonJS or ES2015 modules, use as you would anything else.
You can include source maps on your build system to debug on development. Don’t forget to Uglify on production.

// in ECMAScript 6
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
// or in ECMAScript 5
var ReactBSTable = require('react-bootstrap-table');  
var BootstrapTable = ReactBSTable.BootstrapTable;
var TableHeaderColumn = ReactBSTable.TableHeaderColumn;
Browser global(window object)

In the dist folder you have a UMD bundle with source maps (react-bootstrap-table.js) as well as a minified version (react-bootstrap-table.min.js).

<script src="path/to/react-bootstrap-table/dist/react-bootstrap-table.min.js" />
<script>
  var ReactBsTable = window.BootstrapTable;
  //...
<script/>

The UMD build is also available on npmcdn:

// source maps: https://npmcdn.com/react-bootstrap-table/dist/react-bootstrap-table.js.map
<script src="https://npmcdn.com/react-bootstrap-table/dist/react-bootstrap-table.js"></script>
// or use the min version
<script src="https://npmcdn.com/react-bootstrap-table/dist/react-bootstrap-table.min.js"></script>

c.Import CSS

Finally, you need to import the css file to your app, there are two css file you can choose.
react-bootstrap-table-all.min.css include toastr.
react-bootstrap-table.min.css doesn’t include toastr.
Notes: react-bootstrap-table use toastr to alarm some message to user.

<link rel="stylesheet" href="./dist/react-bootstrap-table-all.min.css">

The CSS files you can find in the css folder.

Quick Demo

// products will be presented by react-bootstrap-table
var products = [{
      id: 1,
      name: "Item name 1",
      price: 100
  },{
      id: 2,
      name: "Item name 2",
      price: 100
  },........];
// It's a data format example.
function priceFormatter(cell, row){
  return '<i class="glyphicon glyphicon-usd"></i> ' + cell;
}

React.render(
  <BootstrapTable data={products} striped={true} hover={true}>
      <TableHeaderColumn dataField="id" isKey={true} dataAlign="center" dataSort={true}>Product ID</TableHeaderColumn>
      <TableHeaderColumn dataField="name" dataSort={true}>Product Name</TableHeaderColumn>
      <TableHeaderColumn dataField="price" dataFormat={priceFormatter}>Product Price</TableHeaderColumn>
  </BootstrapTable>,
	document.getElementById("app")
);

More react-bootstrap-table examples

The example source codes is in the examples folder. Run the following commands for a live demo.

$ git clone https://github.com/AllenFang/react-bootstrap-table.git
$ cd react-bootstrap-table
$ npm install
$ gulp example-server #after start, open browser and go to http://localhost:3004

Documentation

Thanks

luqin
Help this project to integrate a better examples demo, add travis & badge, code formatting, give a lot of suggestions and bugs report.
Whien
Implement a lots of awesome new feature and also fix some bugs and enhancements.
khinlatt
Contribute export csv, multi-search and bug fixing.
dana
Contribute a new colum-filter design and great feedback given.
tbaeg
Bugs report and give some bootstrap and css suggestions actively.
bluedarker
Contribute the edit format & validation on cell editing and row insertion. Improve the custom styling.
Sofia Silva
Bug reports and fixing actively.
frontsideair
Fixing bugs and give improvement for functionality.
aaronhayes
Bugs report and enhance the cell formatting.
Reggino
Implement the TableDataSet component.

Related Repositories

react-bootstrap-table

react-bootstrap-table

It's a react table for bootstrap ...

react-tisch

react-tisch

Table component for React and Bootstrap with real React components as cells ...

react-bootstrap-table

react-bootstrap-table

It's a react table for bootstrap ...

react-table-for-bootstrap

react-table-for-bootstrap

React.js component to generate table styled with Bootstrap CSS classes ...

react-bootstrap-table

react-bootstrap-table

It's a react table for bootstrap ...


Top Contributors

AllenFang staminaloops luqin madeinfree dana2208 jfernandogt frontsideair khinlatt ianks bluedarker opensourcegeek Glognus jfremy jochenberger narfman0 diazproduction aaronhayes bontibon deadbeef404 jrsquared Kurtas scharf r1g0 doshisunny vladelpmk abhirao kaspnilsson staskorz Anenth chentsulin

Dependencies

package version
classnames ^2.1.2
react-modal ^1.4.0
@allenfang/react-toastr 2.8.2
dev babel-core ^6.0.0
babel-eslint ^6.0.0
babel-loader ^6.0.0
babel-preset-es2015 ^6.18.0
babel-preset-react ^6.16.0
babel-preset-stage-0 ^6.16.0
babelify ^6.4.0
bootstrap 3.3.5
browserify ^11.2.0
css-loader ^0.21.0
del ^2.2.0
eslint 1.7.3
eslint-config-airbnb 0.1.0
eslint-loader ^1.3.0
eslint-plugin-react 3.6.3
gulp ^3.9.1
gulp-babel ^6.0.0
gulp-concat-css ^2.2.0
gulp-cssmin ^0.1.7
gulp-shell ^0.5.2
history 3.0.0
jest-cli ^19.0.2
jquery ^2.1.4
jsx-loader ^0.13.2
react ^0.14.3 || ^15.0.0
react-bootstrap ^0.29.5
react-dom ^0.14.3 || ^15.0.0
react-hot-loader ^3.0.0-beta.6
react-router ^3.0.0
style-loader ^0.13.0
styled-components ^1.2.1
toastr ^2.1.2
vinyl-source-stream ^1.1.0
watchify ^3.0.0
webpack ^1.12.4
webpack-dev-server ^1.12.1
peer react ^0.14.3 || ^15.0.0

Releases

-   v2.5.5 zip tar
-   v2.5.4 zip tar
-   v2.5.3 zip tar
-   v2.5.2 zip tar
-   v2.5.1 zip tar
-   v2.5.0 zip tar
-   v2.4.4 zip tar
-   v2.4.3 zip tar
-   v2.4.2 zip tar
-   v2.4.0 zip tar
-   v2.3.9 zip tar
-   v2.3.8 zip tar
-   v2.3.7 zip tar
-   v2.3.6 zip tar
-   v2.3.5 zip tar
-   v2.3.4 zip tar
-   v2.3.3 zip tar
-   v2.3.2 zip tar
-   v2.3.1 zip tar
-   v2.3.0 zip tar
-   v2.2.0 zip tar
-   v2.1.5 zip tar
-   v2.1.4 zip tar
-   v2.1.3 zip tar
-   v2.1.2 zip tar
-   v2.1.1 zip tar
-   v2.1.0 zip tar
-   v2.0.3 zip tar
-   v2.0.2 zip tar
-   v2.0.1 zip tar