You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`filter` allow user to filter data by column. However, filter funcitonality is separated from core of `react-bootstrap-table2` so that you are suppose to install `react-bootstrap-table2-filter` firstly.
Copy file name to clipboardExpand all lines: docs/columns.md
+29-7Lines changed: 29 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,20 +31,22 @@ Available properties in a column object:
31
31
*[validator](#validator)
32
32
*[editCellStyle](#editCellStyle)
33
33
*[editCellClasses](#editCellClasses)
34
+
*[filter](#filter)
35
+
*[filterValue](#filterValue)
34
36
35
37
Following is a most simplest and basic usage:
36
38
37
39
```js
38
40
constrows= [ { id:1, name:'...', price:'102' } ];
39
41
constcolumns= [ {
40
-
dataField:id,
41
-
text: Production ID
42
+
dataField:'id',
43
+
text:'Production ID'
42
44
}, {
43
-
dataField: name,
44
-
text: Production Name
45
+
dataField:'name',
46
+
text:'Production Name'
45
47
}, {
46
-
dataField: price,
47
-
text: Production Price
48
+
dataField:'price',
49
+
text:'Production Price'
48
50
}
49
51
];
50
52
```
@@ -525,4 +527,24 @@ Or take a callback function
525
527
// it is suppose to return a string
526
528
}
527
529
}
528
-
```
530
+
```
531
+
532
+
## <aname='filter'>column.filter - [Object]</a>
533
+
Configure `column.filter` will able to setup a column level filter on the header column. Currently, `react-bootstrap-table2` support following filters:
534
+
535
+
* Text(`textFilter`)
536
+
537
+
We have a quick example to show you how to use `column.filter`:
538
+
539
+
```
540
+
import { textFilter } from 'react-bootstrap-table2-filter';
541
+
542
+
// omit...
543
+
{
544
+
dataField: 'price',
545
+
text: 'Product Price',
546
+
filter: textFilter()
547
+
}
548
+
```
549
+
550
+
For some reason of simple customization, `react-bootstrap-table2` allow you to pass some props to filter factory function. Please check [here](https://github.com/react-bootstrap-table/react-bootstrap-table2/tree/master/packages/react-bootstrap-table2-filter/README.md) for more detail tutorial.
0 commit comments