react-bootstrap-table2/packages/react-bootstrap-table2-filter
2018-01-22 00:30:26 +08:00
..
src fix bug when remote pagination have same filter conds but change pages will cause data doesnt reflect 2018-01-21 17:12:07 +08:00
test fix bug when remote pagination have same filter conds but change pages will cause data doesnt reflect 2018-01-21 17:12:07 +08:00
index.js react-bootstrap-table2-example depend other packages via webpack resolver instead of node modules 2018-01-14 18:29:27 +08:00
package.json v0.1.1 2018-01-22 00:30:26 +08:00
README.md tweak README.md 2018-01-21 23:31:42 +08:00

react-bootstrap-table2-filter

react-bootstrap-table2 separate the filter core code base to react-bootstrap-table2-filter, so there's a little bit different when you use column filter than react-bootstrap-table. In the following, we are going to show you how to enable the column filter:

Live Demo For Column Filter

API&Props Definitation


Install

$ npm install react-bootstrap-table2-filter --save

You can get all types of filters via import and these filters are a factory function to create a individual filter instance. Currently, we support following filters:

  • TextFilter
  • Coming soon!

Text Filter

Following is a quick demo for enable the column filter on Product Price column!!

import filterFactory, { textFilter } from 'react-bootstrap-table2-filter';

// omit...
const columns = [
  ..., {
  dataField: 'price',
  text: 'Product Price',
  filter: textFilter()
}];

<BootstrapTable keyField='id' data={ products } columns={ columns } filter={ filterFactory() } />

In addition, we preserve all of the filter features and functionality in legacy react-bootstrap-table, but in different way to do it:

import filterFactory, { textFilter, Comparator } from 'react-bootstrap-table2-filter';
// omit...

const priceFilter = textFilter({
  placeholder: 'My Custom PlaceHolder',  // custom the input placeholder
  className: 'my-custom-text-filter', // custom classname on input
  defaultValue: 'test', // default filtering value
  comparator: Comparator.EQ, // default is Comparator.LIKE
  style: { ... }, // your custom styles on input
  delay: 1000 // how long will trigger filtering after user typing, default is 500 ms
});

// omit...