@@ -11,46 +11,22 @@ import {
1111 wrapWithPagination
1212} from './table-factory' ;
1313
14+ import remoteResolver from './props-resolver/remote-resolver' ;
1415import _ from './utils' ;
1516
1617const withDataStore = Base =>
17- class BootstrapTableContainer extends Component {
18+ class BootstrapTableContainer extends remoteResolver ( Component ) {
1819 constructor ( props ) {
1920 super ( props ) ;
2021 this . store = new Store ( props . keyField ) ;
2122 this . store . data = props . data ;
2223 this . handleUpdateCell = this . handleUpdateCell . bind ( this ) ;
23- this . handleRemotePageChange = this . handleRemotePageChange . bind ( this ) ;
24- this . handleRemoteFilterChange = this . handleRemoteFilterChange . bind ( this ) ;
2524 }
2625
2726 componentWillReceiveProps ( nextProps ) {
2827 this . store . data = nextProps . data ;
2928 }
3029
31- getNewestState ( state = { } ) {
32- return {
33- page : this . store . page ,
34- sizePerPage : this . store . sizePerPage ,
35- filters : this . store . filters ,
36- ...state
37- } ;
38- }
39-
40- handleRemotePageChange ( ) {
41- this . props . onTableChange ( 'pagination' , this . getNewestState ( ) ) ;
42- }
43-
44- // refactoring later for isRemotePagination
45- handleRemoteFilterChange ( isRemotePagination ) {
46- const newState = { } ;
47- if ( isRemotePagination ) {
48- const options = this . props . pagination . options || { } ;
49- newState . page = _ . isDefined ( options . pageStartIndex ) ? options . pageStartIndex : 1 ;
50- }
51- this . props . onTableChange ( 'filter' , this . getNewestState ( newState ) ) ;
52- }
53-
5430 handleUpdateCell ( rowId , dataField , newValue ) {
5531 const { cellEdit } = this . props ;
5632 // handle cell editing internal
0 commit comments