Skip to content

Commit d8814f6

Browse files
committed
修复点击工具栏导致搜索框获得焦点的BUG
修复搜索框首次失去焦点时搜索的BUG
1 parent cfc009d commit d8814f6

File tree

7 files changed

+55
-49
lines changed

7 files changed

+55
-49
lines changed

dist/bootstrap-table.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,7 @@ div.fixed-table-scroll-outer {
310310
content: "";
311311
display: block;
312312
clear: both;
313+
visibility: hidden;
314+
line-height: 0;
315+
height: 0;
313316
}

dist/bootstrap-table.js

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @author zhixin wen <[email protected]>
3-
* version: 1.11.2
3+
* version: 1.11.8
44
* https://github.com/wenzhixin/bootstrap-table/
55
*/
66

@@ -453,7 +453,7 @@
453453
return false;
454454
},
455455
onRefresh: function (params) {
456-
return false;
456+
return false;
457457
},
458458
onResetView: function () {
459459
return false;
@@ -881,10 +881,10 @@
881881

882882
this.$selectAll = this.$header.find('[name="btSelectAll"]');
883883
this.$selectAll.off('click').on('click', function () {
884-
var checked = $(this).prop('checked');
885-
that[checked ? 'checkAll' : 'uncheckAll']();
886-
that.updateSelected();
887-
});
884+
var checked = $(this).prop('checked');
885+
that[checked ? 'checkAll' : 'uncheckAll']();
886+
that.updateSelected();
887+
});
888888
};
889889

890890
BootstrapTable.prototype.initFooter = function () {
@@ -1064,37 +1064,37 @@
10641064

10651065
if (this.options.showPaginationSwitch) {
10661066
html.push(sprintf('<button class="btn' +
1067-
sprintf(' btn-%s', this.options.buttonsClass) +
1068-
sprintf(' btn-%s', this.options.iconSize) +
1069-
'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',
1070-
this.options.formatPaginationSwitch()),
1067+
sprintf(' btn-%s', this.options.buttonsClass) +
1068+
sprintf(' btn-%s', this.options.iconSize) +
1069+
'" type="button" name="paginationSwitch" aria-label="pagination Switch" title="%s">',
1070+
this.options.formatPaginationSwitch()),
10711071
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.paginationSwitchDown),
10721072
'</button>');
10731073
}
10741074

10751075
if (this.options.showRefresh) {
10761076
html.push(sprintf('<button class="btn' +
1077-
sprintf(' btn-%s', this.options.buttonsClass) +
1078-
sprintf(' btn-%s', this.options.iconSize) +
1079-
'" type="button" name="refresh" aria-label="refresh" title="%s">',
1080-
this.options.formatRefresh()),
1077+
sprintf(' btn-%s', this.options.buttonsClass) +
1078+
sprintf(' btn-%s', this.options.iconSize) +
1079+
'" type="button" name="refresh" aria-label="refresh" title="%s">',
1080+
this.options.formatRefresh()),
10811081
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.refresh),
10821082
'</button>');
10831083
}
10841084

10851085
if (this.options.showToggle) {
10861086
html.push(sprintf('<button class="btn' +
1087-
sprintf(' btn-%s', this.options.buttonsClass) +
1088-
sprintf(' btn-%s', this.options.iconSize) +
1089-
'" type="button" name="toggle" aria-label="toggle" title="%s">',
1090-
this.options.formatToggle()),
1087+
sprintf(' btn-%s', this.options.buttonsClass) +
1088+
sprintf(' btn-%s', this.options.iconSize) +
1089+
'" type="button" name="toggle" aria-label="toggle" title="%s">',
1090+
this.options.formatToggle()),
10911091
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.toggle),
10921092
'</button>');
10931093
}
10941094

10951095
if (this.options.showColumns) {
10961096
html.push(sprintf('<div class="keep-open btn-group" title="%s">',
1097-
this.options.formatColumns()),
1097+
this.options.formatColumns()),
10981098
'<button type="button" aria-label="columns" class="btn' +
10991099
sprintf(' btn-%s', this.options.buttonsClass) +
11001100
sprintf(' btn-%s', this.options.iconSize) +
@@ -1146,8 +1146,8 @@
11461146
if (this.options.showToggle) {
11471147
this.$toolbar.find('button[name="toggle"]')
11481148
.off('click').on('click', function () {
1149-
that.toggleView();
1150-
});
1149+
that.toggleView();
1150+
});
11511151
}
11521152

11531153
if (this.options.showColumns) {
@@ -1214,7 +1214,7 @@
12141214
$(event.currentTarget).val(text);
12151215
}
12161216

1217-
if (text === this.searchText) {
1217+
if (text === this.searchText || (text === '' && typeof this.searchText === 'undefined')) {
12181218
return;
12191219
}
12201220
this.searchText = text;
@@ -1243,7 +1243,7 @@
12431243
this.data = f ? $.grep(this.options.data, function (item, i) {
12441244
for (var key in f) {
12451245
if ($.isArray(f[key]) && $.inArray(item[key], f[key]) === -1 ||
1246-
!$.isArray(f[key]) && item[key] !== f[key]) {
1246+
!$.isArray(f[key]) && item[key] !== f[key]) {
12471247
return false;
12481248
}
12491249
}
@@ -1351,27 +1351,27 @@
13511351
'<div class="pull-' + this.options.paginationDetailHAlign + ' pagination-detail">',
13521352
'<span class="pagination-info">',
13531353
this.options.onlyInfoPagination ? this.options.formatDetailPagination(this.options.totalRows) :
1354-
this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows),
1354+
this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows),
13551355
'</span>');
13561356

13571357
if (!this.options.onlyInfoPagination) {
13581358
html.push('<span class="page-list">');
13591359

13601360
var pageNumber = [
1361-
sprintf('<span class="btn-group %s">',
1362-
this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?
1363-
'dropdown' : 'dropup'),
1364-
'<button type="button" class="btn' +
1365-
sprintf(' btn-%s', this.options.buttonsClass) +
1366-
sprintf(' btn-%s', this.options.iconSize) +
1367-
' dropdown-toggle" data-toggle="dropdown">',
1368-
'<span class="page-size">',
1369-
$allSelected ? this.options.formatAllRows() : this.options.pageSize,
1370-
'</span>',
1371-
' <span class="caret"></span>',
1372-
'</button>',
1373-
'<ul class="dropdown-menu" role="menu">'
1374-
];
1361+
sprintf('<span class="btn-group %s">',
1362+
this.options.paginationVAlign === 'top' || this.options.paginationVAlign === 'both' ?
1363+
'dropdown' : 'dropup'),
1364+
'<button type="button" class="btn' +
1365+
sprintf(' btn-%s', this.options.buttonsClass) +
1366+
sprintf(' btn-%s', this.options.iconSize) +
1367+
' dropdown-toggle" data-toggle="dropdown">',
1368+
'<span class="page-size">',
1369+
$allSelected ? this.options.formatAllRows() : this.options.pageSize,
1370+
'</span>',
1371+
' <span class="caret"></span>',
1372+
'</button>',
1373+
'<ul class="dropdown-menu" role="menu">'
1374+
];
13751375

13761376
if (typeof this.options.pageList === 'string') {
13771377
var list = this.options.pageList.replace('[', '').replace(']', '')
@@ -1744,16 +1744,16 @@
17441744
type = column.radio ? 'radio' : type;
17451745

17461746
text = [sprintf(that.options.cardView ?
1747-
'<div class="card-view %s">' : '<td class="bs-checkbox %s">', column['class'] || ''),
1747+
'<div class="card-view %s">' : '<td class="bs-checkbox %s">', column['class'] || ''),
17481748
'<input' +
17491749
sprintf(' data-index="%s"', i) +
17501750
sprintf(' name="%s"', that.options.selectItemName) +
17511751
sprintf(' type="%s"', type) +
17521752
sprintf(' value="%s"', item[that.options.idField]) +
17531753
sprintf(' checked="%s"', value === true ||
1754-
(value_ || value && value.checked) ? 'checked' : undefined) +
1754+
(value_ || value && value.checked) ? 'checked' : undefined) +
17551755
sprintf(' disabled="%s"', !column.checkboxEnabled ||
1756-
(value && value.disabled) ? 'disabled' : undefined) +
1756+
(value && value.disabled) ? 'disabled' : undefined) +
17571757
' />',
17581758
that.header.formatters[j] && typeof value === 'string' ? value : '',
17591759
that.options.cardView ? '</div>' : '</td>'
@@ -1770,7 +1770,7 @@
17701770
sprintf('<span class="value">%s</span>', value),
17711771
'</div>'
17721772
].join('') : [sprintf('<td%s %s %s %s %s %s %s>',
1773-
id_, class_, style, data_, rowspan_, colspan_, title_),
1773+
id_, class_, style, data_, rowspan_, colspan_, title_),
17741774
value,
17751775
'</td>'
17761776
].join('');
@@ -1828,8 +1828,8 @@
18281828
if (!hasTr) {
18291829
trFragments.append('<tr class="no-records-found">' +
18301830
sprintf('<td colspan="%s">%s</td>',
1831-
this.$header.find('th').length,
1832-
this.options.formatNoMatches()) +
1831+
this.$header.find('th').length,
1832+
this.options.formatNoMatches()) +
18331833
'</tr>');
18341834
}
18351835

0 commit comments

Comments
 (0)