@@ -347,6 +347,10 @@ return /******/ (function(modules) { // webpackBootstrap
347347 return _this.__handleSearch__REACT_HOT_LOADER__.apply(_this, arguments);
348348 };
349349
350+ _this._scrollTop = function () {
351+ return _this.___scrollTop__REACT_HOT_LOADER__.apply(_this, arguments);
352+ };
353+
350354 _this._scrollHeader = function () {
351355 return _this.___scrollHeader__REACT_HOT_LOADER__.apply(_this, arguments);
352356 };
@@ -568,6 +572,9 @@ return /******/ (function(modules) { // webpackBootstrap
568572 this._adjustTable();
569573 window.addEventListener('resize', this._adjustTable);
570574 this.refs.body.refs.container.addEventListener('scroll', this._scrollHeader);
575+ if (this.props.scrollTop) {
576+ this._scrollTop();
577+ }
571578 }
572579 }, {
573580 key: 'componentWillUnmount',
@@ -1177,6 +1184,11 @@ return /******/ (function(modules) { // webpackBootstrap
11771184 }, {
11781185 key: '__handleSearch__REACT_HOT_LOADER__',
11791186 value: function __handleSearch__REACT_HOT_LOADER__(searchText) {
1187+ // Set search field if this function being called outside
1188+ // but it's not necessary if calling fron inside.
1189+ if (this.refs.toolbar) {
1190+ this.refs.toolbar.setSearchInput(searchText);
1191+ }
11801192 var onSearchChange = this.props.options.onSearchChange;
11811193
11821194 if (onSearchChange) {
@@ -1310,6 +1322,7 @@ return /******/ (function(modules) { // webpackBootstrap
13101322 'div',
13111323 { className: 'react-bs-table-tool-bar' },
13121324 _react2.default.createElement(_ToolBar2.default, {
1325+ ref: 'toolbar',
13131326 defaultSearch: this.props.options.defaultSearch,
13141327 clearSearch: this.props.options.clearSearch,
13151328 searchPosition: this.props.options.searchPosition,
@@ -1361,6 +1374,19 @@ return /******/ (function(modules) { // webpackBootstrap
13611374 return null;
13621375 }
13631376 }
1377+ }, {
1378+ key: '___scrollTop__REACT_HOT_LOADER__',
1379+ value: function ___scrollTop__REACT_HOT_LOADER__() {
1380+ var scrollTop = this.props.scrollTop;
1381+
1382+ if (scrollTop === _Const2.default.SCROLL_TOP) {
1383+ this.refs.body.refs.container.scrollTop = 0;
1384+ } else if (scrollTop === _Const2.default.SCROLL_BOTTOM) {
1385+ this.refs.body.refs.container.scrollTop = this.refs.body.refs.container.scrollHeight;
1386+ } else if (typeof scrollTop === 'number' && !isNaN(scrollTop)) {
1387+ this.refs.body.refs.container.scrollTop = scrollTop;
1388+ }
1389+ }
13641390 }, {
13651391 key: '___scrollHeader__REACT_HOT_LOADER__',
13661392 value: function ___scrollHeader__REACT_HOT_LOADER__(e) {
@@ -1387,7 +1413,7 @@ return /******/ (function(modules) { // webpackBootstrap
13871413 var cells = firstRow.childNodes;
13881414 for (var i = 0; i < cells.length; i++) {
13891415 var cell = cells[i];
1390- var computedStyle = getComputedStyle ( cell ) ;
1416+ var computedStyle = window. getComputedStyle(cell);
13911417 var width = parseFloat(computedStyle.width.replace('px', ''));
13921418 if (this.isIE) {
13931419 var paddingLeftWidth = parseFloat(computedStyle.paddingLeft.replace('px', ''));
@@ -1477,6 +1503,7 @@ return /******/ (function(modules) { // webpackBootstrap
14771503 maxHeight: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.number]),
14781504 data: _react.PropTypes.oneOfType([_react.PropTypes.array, _react.PropTypes.object]),
14791505 remote: _react.PropTypes.bool, // remote data, default is false
1506+ scrollTop: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.number]),
14801507 striped: _react.PropTypes.bool,
14811508 bordered: _react.PropTypes.bool,
14821509 hover: _react.PropTypes.bool,
@@ -1596,6 +1623,7 @@ return /******/ (function(modules) { // webpackBootstrap
15961623 expandComponent: _react.PropTypes.func
15971624 };
15981625 BootstrapTable.defaultProps = {
1626+ scrollTop: undefined,
15991627 expandComponent: undefined,
16001628 expandableRow: undefined,
16011629 height: '100%',
@@ -1834,6 +1862,8 @@ return /******/ (function(modules) { // webpackBootstrap
18341862 SAVE_BTN_TEXT: 'Save',
18351863 CLOSE_BTN_TEXT: 'Close',
18361864 FILTER_DELAY: 500,
1865+ SCROLL_TOP: 'Top',
1866+ SCROLL_BOTTOM: 'Bottom',
18371867 FILTER_TYPE: {
18381868 TEXT: 'TextFilter',
18391869 REGEX: 'RegexFilter',
@@ -5590,16 +5620,16 @@ return /******/ (function(modules) { // webpackBootstrap
55905620/* 77 */
55915621/***/ function(module, exports) {
55925622
5593- module . exports = function ( module ) {
5594- if ( ! module . webpackPolyfill ) {
5595- module . deprecate = function ( ) { } ;
5596- module . paths = [ ] ;
5597- // module.parent = undefined by default
5598- module . children = [ ] ;
5599- module . webpackPolyfill = 1 ;
5600- }
5601- return module ;
5602- }
5623+ module.exports = function(module) {
5624+ if(!module.webpackPolyfill) {
5625+ module.deprecate = function() {};
5626+ module.paths = [];
5627+ // module.parent = undefined by default
5628+ module.children = [];
5629+ module.webpackPolyfill = 1;
5630+ }
5631+ return module;
5632+ }
56035633
56045634
56055635/***/ },
@@ -10489,6 +10519,13 @@ return /******/ (function(modules) { // webpackBootstrap
1048910519 value: function componentWillUnmount() {
1049010520 this.clearTimeout();
1049110521 }
10522+ }, {
10523+ key: 'setSearchInput',
10524+ value: function setSearchInput(text) {
10525+ if (this.refs.seachInput.value !== text) {
10526+ this.refs.seachInput.value = text;
10527+ }
10528+ }
1049210529 }, {
1049310530 key: 'clearTimeout',
1049410531 value: function (_clearTimeout) {
@@ -13598,7 +13635,7 @@ return /******/ (function(modules) { // webpackBootstrap
1359813635>>>>>>> master
1359913636/***/ function(module, exports) {
1360013637
13601- module . exports = function ( ) { throw new Error ( "define cannot be used indirect" ) ; } ;
13638+ module.exports = function() { throw new Error("define cannot be used indirect"); };
1360213639
1360313640
1360413641/***/ },
@@ -13609,7 +13646,7 @@ return /******/ (function(modules) { // webpackBootstrap
1360913646>>>>>>> master
1361013647/***/ function(module, exports) {
1361113648
13612- /* WEBPACK VAR INJECTION */ ( function ( __webpack_amd_options__ ) { module . exports = __webpack_amd_options__ ;
13649+ /* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__;
1361313650
1361413651 /* WEBPACK VAR INJECTION */}.call(exports, {}))
1361513652
0 commit comments