|
41 | 41 | }); |
42 | 42 | return result; |
43 | 43 | }; |
44 | | - |
| 44 | + |
45 | 45 | // http://jsfiddle.net/wenyi/47nz7ez9/3/ |
46 | 46 | var setFieldIndex = function (columns) { |
47 | 47 | var i, j, k, |
|
2155 | 2155 | .html('').attr('class', this.$el.attr('class')) |
2156 | 2156 | .append(this.$header_); |
2157 | 2157 |
|
2158 | | - |
2159 | 2158 | focusedTemp = $('.focus-temp:visible:eq(0)'); |
2160 | 2159 | if (focusedTemp.length > 0) { |
2161 | 2160 | focusedTemp.focus(); |
|
2188 | 2187 |
|
2189 | 2188 | $th.find('.fht-cell').width($this.innerWidth()); |
2190 | 2189 | }); |
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()); |
2195 | 2190 |
|
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'); |
2201 | 2193 | }; |
2202 | 2194 |
|
2203 | 2195 | BootstrapTable.prototype.resetFooter = function () { |
|
2285 | 2277 |
|
2286 | 2278 | $footerTd.eq(i).find('.fht-cell').width($this.innerWidth()); |
2287 | 2279 | }); |
| 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 | + }); |
2288 | 2297 | }; |
2289 | 2298 |
|
2290 | 2299 | BootstrapTable.prototype.toggleColumn = function (index, checked, needUpdate) { |
|
2807 | 2816 | if (this.options.showHeader && this.options.height) { |
2808 | 2817 | this.fitHeader(); |
2809 | 2818 | } |
2810 | | - if (this.options.showFooter) { |
| 2819 | + if (this.options.showFooter && !that.options.cardView) { |
2811 | 2820 | this.fitFooter(); |
2812 | 2821 | } |
2813 | 2822 | }; |
|