GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix #2999: Fix horizontal scroll bug · jb091/bootstrap-table@3dc5505

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • bootstrap-table.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/bootstrap-table.js‎

Copy file name to clipboardExpand all lines: src/bootstrap-table.js
+21-12Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
});
4242
return result;
4343
};
44-
44+
4545
// http://jsfiddle.net/wenyi/47nz7ez9/3/
4646
var setFieldIndex = function (columns) {
4747
var i, j, k,
@@ -2155,7 +2155,6 @@
21552155
.html('').attr('class', this.$el.attr('class'))
21562156
.append(this.$header_);
21572157

2158-
21592158
focusedTemp = $('.focus-temp:visible:eq(0)');
21602159
if (focusedTemp.length > 0) {
21612160
focusedTemp.focus();
@@ -2188,16 +2187,9 @@
21882187

21892188
$th.find('.fht-cell').width($this.innerWidth());
21902189
});
2191-
// horizontal scroll event
2192-
// TODO: it's probably better improving the layout than binding to scroll event
2193-
this.$tableBody.off('scroll').on('scroll', function () {
2194-
that.$tableHeader.scrollLeft($(this).scrollLeft());
21952190

2196-
if (that.options.showFooter && !that.options.cardView) {
2197-
that.$tableFooter.scrollLeft($(this).scrollLeft());
2198-
}
2199-
});
2200-
that.trigger('post-header');
2191+
this.horizontalScroll();
2192+
this.trigger('post-header');
22012193
};
22022194

22032195
BootstrapTable.prototype.resetFooter = function () {
@@ -2285,6 +2277,23 @@
22852277

22862278
$footerTd.eq(i).find('.fht-cell').width($this.innerWidth());
22872279
});
2280+
2281+
this.horizontalScroll();
2282+
};
2283+
2284+
BootstrapTable.prototype.horizontalScroll = function () {
2285+
var that = this;
2286+
// horizontal scroll event
2287+
// TODO: it's probably better improving the layout than binding to scroll event
2288+
this.$tableBody.off('scroll').on('scroll', function () {
2289+
if (that.options.showHeader && that.options.height) {
2290+
that.$tableHeader.scrollLeft($(this).scrollLeft());
2291+
}
2292+
2293+
if (that.options.showFooter && !that.options.cardView) {
2294+
that.$tableFooter.scrollLeft($(this).scrollLeft());
2295+
}
2296+
});
22882297
};
22892298

22902299
BootstrapTable.prototype.toggleColumn = function (index, checked, needUpdate) {
@@ -2807,7 +2816,7 @@
28072816
if (this.options.showHeader && this.options.height) {
28082817
this.fitHeader();
28092818
}
2810-
if (this.options.showFooter) {
2819+
if (this.options.showFooter && !that.options.cardView) {
28112820
this.fitFooter();
28122821
}
28132822
};

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.