Skip to content

Commit

Permalink
Merge pull request wenzhixin#3223 from mqy1023/develop
Browse files Browse the repository at this point in the history
Add table's body scrolling event listener function
  • Loading branch information
wenzhixin authored Dec 13, 2017
2 parents 2e3a8cb + d51fc72 commit 5389059
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/bootstrap-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,9 @@
},
onResetView: function () {
return false;
},
onScrollBody: function () {
return false;
}
};

Expand Down Expand Up @@ -586,7 +589,8 @@
'collapse-row.bs.table': 'onCollapseRow',
'refresh-options.bs.table': 'onRefreshOptions',
'reset-view.bs.table': 'onResetView',
'refresh.bs.table': 'onRefresh'
'refresh.bs.table': 'onRefresh',
'scroll-body.bs.table': 'onScrollBody'
};

BootstrapTable.prototype.init = function () {
Expand Down Expand Up @@ -2352,6 +2356,8 @@
var that = this;
// horizontal scroll event
// TODO: it's probably better improving the layout than binding to scroll event

that.trigger('scroll-body');
this.$tableBody.off('scroll').on('scroll', function () {
if (that.options.showHeader && that.options.height) {
that.$tableHeader.scrollLeft($(this).scrollLeft());
Expand Down

0 comments on commit 5389059

Please sign in to comment.