Skip to content

Commit a5fd46c

Browse files
committed
修复固定列在cardView模式下报错的BUG
1 parent a2c149f commit a5fd46c

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

dist/extensions/fixed-columns/bootstrap-table-fixed-columns.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,22 +169,25 @@
169169
this.$tableBody.css("height", "100%");
170170
this.$fixedColumns && this.$fixedColumns.show();
171171
this.$fixedColumnsRight && this.$fixedColumnsRight.show();
172-
this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
173-
this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
172+
this.$fixedHeaderRight && this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
173+
this.$fixedBodyRight && this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
174174
}
175175
}
176176
if (!that.fixedColumnsSupported()) {
177177
return;
178178
}
179179
if (arguments[0] === 'post-header') {
180+
if (!this.$fixedColumns && !this.$fixedColumnsRight) {
181+
this.initFixedContainer();
182+
}
180183
this.initFixedColumnsHeader();
181184
} else if (arguments[0] === 'scroll-body') {
182185
if (this.needFixedColumns && this.options.fixedNumber) {
183-
this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
186+
this.$fixedBody && this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
184187
}
185188

186189
if (this.needFixedColumns && this.options.fixedRightNumber) {
187-
this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
190+
this.$fixedBodyRight && this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
188191
}
189192
} else if (arguments[0] === 'load-success') {
190193
this.hideLoading();

src/extensions/fixed-columns/bootstrap-table-fixed-columns.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,22 +169,25 @@
169169
this.$tableBody.css("height", "100%");
170170
this.$fixedColumns && this.$fixedColumns.show();
171171
this.$fixedColumnsRight && this.$fixedColumnsRight.show();
172-
this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
173-
this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
172+
this.$fixedHeaderRight && this.$fixedHeaderRight.scrollLeft(this.$tableBody.find('table').width());
173+
this.$fixedBodyRight && this.$fixedBodyRight.scrollLeft(this.$tableBody.find('table').width());
174174
}
175175
}
176176
if (!that.fixedColumnsSupported()) {
177177
return;
178178
}
179179
if (arguments[0] === 'post-header') {
180+
if (!this.$fixedColumns && !this.$fixedColumnsRight) {
181+
this.initFixedContainer();
182+
}
180183
this.initFixedColumnsHeader();
181184
} else if (arguments[0] === 'scroll-body') {
182185
if (this.needFixedColumns && this.options.fixedNumber) {
183-
this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
186+
this.$fixedBody && this.$fixedBody.scrollTop(this.$tableBody.scrollTop());
184187
}
185188

186189
if (this.needFixedColumns && this.options.fixedRightNumber) {
187-
this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
190+
this.$fixedBodyRight && this.$fixedBodyRight.scrollTop(this.$tableBody.scrollTop());
188191
}
189192
} else if (arguments[0] === 'load-success') {
190193
this.hideLoading();

0 commit comments

Comments
 (0)