File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
packages/react-bootstrap-table2-filter Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export default (Base, {
2424 componentWillReceiveProps ( { isDataChanged, store, columns } ) {
2525 // consider to use lodash.isEqual
2626 if ( JSON . stringify ( this . state . currFilters ) !== JSON . stringify ( store . filters ) ) {
27+ store . filteredData = store . getAllData ( ) ;
2728 this . setState ( ( ) => ( { isDataChanged : true , currFilters : store . filters } ) ) ;
2829 } else if ( isDataChanged ) {
2930 if ( ! ( this . isRemoteFiltering ( ) || this . isRemotePagination ( ) ) &&
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ describe('Wrapper', () => {
106106 } ) ;
107107 } ) ;
108108
109- describe ( 'when props.isDataChanged is true and remote is enable ' , ( ) => {
109+ describe ( 'when props.isDataChanged is true' , ( ) => {
110110 beforeEach ( ( ) => {
111111 nextProps = createTableProps ( { isDataChanged : true } ) ;
112112 instance . componentWillReceiveProps ( nextProps ) ;
@@ -118,13 +118,17 @@ describe('Wrapper', () => {
118118 } ) ;
119119
120120 describe ( 'when props.store.filters is different from current state.currFilters' , ( ) => {
121+ const nextData = [ ] ;
122+
121123 beforeEach ( ( ) => {
122124 nextProps = createTableProps ( ) ;
123125 nextProps . store . filters = { price : { filterVal : 20 , filterType : FILTER_TYPE . TEXT } } ;
126+ nextProps . store . setAllData ( nextData ) ;
124127 instance . componentWillReceiveProps ( nextProps ) ;
125128 } ) ;
126129
127130 it ( 'should setting states correctly' , ( ) => {
131+ expect ( nextProps . store . filteredData ) . toEqual ( nextData ) ;
128132 expect ( instance . state . isDataChanged ) . toBeTruthy ( ) ;
129133 expect ( instance . state . currFilters ) . toBe ( nextProps . store . filters ) ;
130134 } ) ;
You can’t perform that action at this time.
0 commit comments