@@ -138,6 +138,10 @@ var BootstrapTable = function (_Component) {
138138 return _this . __handleSearch__REACT_HOT_LOADER__ . apply ( _this , arguments ) ;
139139 } ;
140140
141+ _this . _scrollTop = function ( ) {
142+ return _this . ___scrollTop__REACT_HOT_LOADER__ . apply ( _this , arguments ) ;
143+ } ;
144+
141145 _this . _scrollHeader = function ( ) {
142146 return _this . ___scrollHeader__REACT_HOT_LOADER__ . apply ( _this , arguments ) ;
143147 } ;
@@ -359,6 +363,9 @@ var BootstrapTable = function (_Component) {
359363 this . _adjustTable ( ) ;
360364 window . addEventListener ( 'resize' , this . _adjustTable ) ;
361365 this . refs . body . refs . container . addEventListener ( 'scroll' , this . _scrollHeader ) ;
366+ if ( this . props . scrollTop ) {
367+ this . _scrollTop ( ) ;
368+ }
362369 }
363370 } , {
364371 key : 'componentWillUnmount' ,
@@ -953,6 +960,11 @@ var BootstrapTable = function (_Component) {
953960 } , {
954961 key : '__handleSearch__REACT_HOT_LOADER__' ,
955962 value : function __handleSearch__REACT_HOT_LOADER__ ( searchText ) {
963+ // Set search field if this function being called outside
964+ // but it's not necessary if calling fron inside.
965+ if ( this . refs . toolbar ) {
966+ this . refs . toolbar . setSearchInput ( searchText ) ;
967+ }
956968 var onSearchChange = this . props . options . onSearchChange ;
957969
958970 if ( onSearchChange ) {
@@ -1073,6 +1085,7 @@ var BootstrapTable = function (_Component) {
10731085 'div' ,
10741086 { className : 'react-bs-table-tool-bar' } ,
10751087 _react2 . default . createElement ( _ToolBar2 . default , {
1088+ ref : 'toolbar' ,
10761089 defaultSearch : this . props . options . defaultSearch ,
10771090 clearSearch : this . props . options . clearSearch ,
10781091 searchDelayTime : this . props . options . searchDelayTime ,
@@ -1110,6 +1123,19 @@ var BootstrapTable = function (_Component) {
11101123 return null ;
11111124 }
11121125 }
1126+ } , {
1127+ key : '___scrollTop__REACT_HOT_LOADER__' ,
1128+ value : function ___scrollTop__REACT_HOT_LOADER__ ( ) {
1129+ var scrollTop = this . props . scrollTop ;
1130+
1131+ if ( scrollTop === _Const2 . default . SCROLL_TOP ) {
1132+ this . refs . body . refs . container . scrollTop = 0 ;
1133+ } else if ( scrollTop === _Const2 . default . SCROLL_BOTTOM ) {
1134+ this . refs . body . refs . container . scrollTop = this . refs . body . refs . container . scrollHeight ;
1135+ } else if ( typeof scrollTop === 'number' && ! isNaN ( scrollTop ) ) {
1136+ this . refs . body . refs . container . scrollTop = scrollTop ;
1137+ }
1138+ }
11131139 } , {
11141140 key : '___scrollHeader__REACT_HOT_LOADER__' ,
11151141 value : function ___scrollHeader__REACT_HOT_LOADER__ ( e ) {
@@ -1226,6 +1252,7 @@ BootstrapTable.propTypes = {
12261252 maxHeight : _react . PropTypes . oneOfType ( [ _react . PropTypes . string , _react . PropTypes . number ] ) ,
12271253 data : _react . PropTypes . oneOfType ( [ _react . PropTypes . array , _react . PropTypes . object ] ) ,
12281254 remote : _react . PropTypes . bool , // remote data, default is false
1255+ scrollTop : _react . PropTypes . oneOfType ( [ _react . PropTypes . string , _react . PropTypes . number ] ) ,
12291256 striped : _react . PropTypes . bool ,
12301257 bordered : _react . PropTypes . bool ,
12311258 hover : _react . PropTypes . bool ,
@@ -1323,6 +1350,7 @@ BootstrapTable.propTypes = {
13231350 expandComponent : _react . PropTypes . func
13241351} ;
13251352BootstrapTable . defaultProps = {
1353+ scrollTop : undefined ,
13261354 expandComponent : undefined ,
13271355 expandableRow : undefined ,
13281356 height : '100%' ,
@@ -1429,9 +1457,9 @@ var _temp = function () {
14291457 return ;
14301458 }
14311459
1432- __REACT_HOT_LOADER__ . register ( BootstrapTable , 'BootstrapTable' , '/Users/omerfarukalmali/Projects/personal/js/reactjs/oalmali /react-bootstrap-table/src/BootstrapTable.js' ) ;
1460+ __REACT_HOT_LOADER__ . register ( BootstrapTable , 'BootstrapTable' , '/Users/allen/Node/react-bootstrap-table-new /react-bootstrap-table/src/BootstrapTable.js' ) ;
14331461
1434- __REACT_HOT_LOADER__ . register ( _default , 'default' , '/Users/omerfarukalmali/Projects/personal/js/reactjs/oalmali /react-bootstrap-table/src/BootstrapTable.js' ) ;
1462+ __REACT_HOT_LOADER__ . register ( _default , 'default' , '/Users/allen/Node/react-bootstrap-table-new /react-bootstrap-table/src/BootstrapTable.js' ) ;
14351463} ( ) ;
14361464
14371465;
0 commit comments