File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
packages/react-bootstrap-table2-example/examples/column-filter Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,12 @@ import BootstrapTable from 'react-bootstrap-table-next';
1212import filterFactory, { textFilter } from 'react-bootstrap-table2-filter';
1313
1414class Table extends React.Component {
15- filterByPrice = filterVal =>
16- products.filter(product => product.price == filterVal);
15+ filterByPrice = (filterVal) => {
16+ if (filterVal) {
17+ return products.filter(product => product.price == filterVal);
18+ }
19+ return products;
20+ }
1721
1822 render() {
1923 const columns = [{
@@ -46,8 +50,12 @@ class Table extends React.Component {
4650` ;
4751
4852export default class Table extends React . Component {
49- filterByPrice = filterVal =>
50- products . filter ( product => product . price == filterVal ) ;
53+ filterByPrice = ( filterVal ) => {
54+ if ( filterVal ) {
55+ return products . filter ( product => product . price == filterVal ) ;
56+ }
57+ return products ;
58+ }
5159
5260 render ( ) {
5361 const columns = [ {
@@ -67,7 +75,7 @@ export default class Table extends React.Component {
6775
6876 return (
6977 < div >
70- < h2 > Implement a eq filter on product price column </ h2 >
78+ < h2 > Implement Custom Filter </ h2 >
7179 < BootstrapTable
7280 keyField = "id"
7381 data = { products }
You can’t perform that action at this time.
0 commit comments