From e6d4a9641bf7bf3c5542d5ecd3fb69b0337efb84 Mon Sep 17 00:00:00 2001 From: AllenFang Date: Tue, 3 Jul 2018 23:26:57 +0800 Subject: [PATCH] data, keyField and columns is necessary value for toolkits context --- .../examples/remote/remote-search.js | 34 +++++++++++++------ .../examples/search/custom-search-value.js | 22 +++++++----- .../examples/search/default-custom-search.js | 20 ++++++----- .../examples/search/fully-custom-search.js | 21 +++++++----- .../examples/search/index.js | 20 ++++++----- .../examples/search/search-formatted.js | 24 +++++++------ .../react-bootstrap-table2-toolkit/context.js | 12 ++++++- .../src/contexts/index.js | 2 +- 8 files changed, 100 insertions(+), 55 deletions(-) diff --git a/packages/react-bootstrap-table2-example/examples/remote/remote-search.js b/packages/react-bootstrap-table2-example/examples/remote/remote-search.js index 7bad91a..1056229 100644 --- a/packages/react-bootstrap-table2-example/examples/remote/remote-search.js +++ b/packages/react-bootstrap-table2-example/examples/remote/remote-search.js @@ -40,15 +40,27 @@ const columns = [{ const RemoteFilter = props => (
- - { sourceCode } + > + + { + toolkitprops => [ + , + + ] + } + +
); @@ -97,16 +109,18 @@ class Container extends React.Component { const RemoteFilter = props => (
- + { toolkitprops => [ , types[cell] // we will search the value after filterValue called }]; - + { props => (
-

Input something at below input field:

+

Try to Search Bob, Cat or Allen instead of 0, 1 or 2


(
- + { props => ( @@ -89,9 +95,7 @@ export default () => (
+ { props => ( @@ -51,9 +55,7 @@ const columns = [{ />
(
- + { props => ( @@ -82,9 +88,7 @@ export default () => ( />
{ ); }; - + { props => (
+
) } @@ -96,15 +99,17 @@ const MySearch = (props) => { export default () => (
- + { props => (
+ { props => ( @@ -45,9 +49,7 @@ const columns = [{
(
- + { props => ( @@ -70,9 +76,7 @@ export default () => (
\`USD \${cell}\` // we will search the data after formatted }]; - + { props => (
-

Input something at below input field:

+

Try to Search USD at below input field:


@@ -64,7 +66,11 @@ const columns = [{ export default () => (
- + { props => ( @@ -73,9 +79,7 @@ export default () => (
{ this.props.children } diff --git a/packages/react-bootstrap-table2/src/contexts/index.js b/packages/react-bootstrap-table2/src/contexts/index.js index d434478..e95ea27 100644 --- a/packages/react-bootstrap-table2/src/contexts/index.js +++ b/packages/react-bootstrap-table2/src/contexts/index.js @@ -13,7 +13,7 @@ const withContext = Base => class BootstrapTableContainer extends remoteResolver(Component) { constructor(props) { super(props); - this.DataContext = createDataContext(props.data); + this.DataContext = createDataContext(); if (props.columns.filter(col => col.sort).length > 0) { this.SortContext = createSortContext(