|
@@ -585,14 +585,14 @@
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
if (addedFilterControl) {
|
|
if (addedFilterControl) {
|
|
|
- this.$header.off('keyup', 'input').on('keyup' , 'input', function (event) {
|
|
|
|
|
|
|
+ this.$header.off('keyup', 'input').on('keyup', 'input', function (event) {
|
|
|
clearTimeout(timeoutId);
|
|
clearTimeout(timeoutId);
|
|
|
timeoutId = setTimeout(function () {
|
|
timeoutId = setTimeout(function () {
|
|
|
that.onColumnSearch(event);
|
|
that.onColumnSearch(event);
|
|
|
}, that.options.searchTimeOut);
|
|
}, that.options.searchTimeOut);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- this.$header.off('change', 'select').on('change' , 'select', function (event) {
|
|
|
|
|
|
|
+ this.$header.off('change', 'select').on('change', 'select', function (event) {
|
|
|
clearTimeout(timeoutId);
|
|
clearTimeout(timeoutId);
|
|
|
timeoutId = setTimeout(function () {
|
|
timeoutId = setTimeout(function () {
|
|
|
that.onColumnSearch(event);
|
|
that.onColumnSearch(event);
|
|
@@ -604,7 +604,7 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
BootstrapTable.prototype.initFooter = function () {
|
|
BootstrapTable.prototype.initFooter = function () {
|
|
|
- this.$footer = this.$container.find('.fixed-table-footer');
|
|
|
|
|
|
|
+ this.$footer = this.$container.find('.fixed-table-footer');
|
|
|
if (!this.options.showFooter || this.options.cardView) {
|
|
if (!this.options.showFooter || this.options.cardView) {
|
|
|
this.$footer.hide();
|
|
this.$footer.hide();
|
|
|
} else {
|
|
} else {
|
|
@@ -907,7 +907,7 @@
|
|
|
if (this.options.sidePagination !== 'server') {
|
|
if (this.options.sidePagination !== 'server') {
|
|
|
var s = this.searchText && this.searchText.toLowerCase();
|
|
var s = this.searchText && this.searchText.toLowerCase();
|
|
|
var f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
|
|
var f = $.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
|
|
|
- var fp = $.isEmptyObject(this.filterColumnsPartial) ? null: this.filterColumnsPartial;
|
|
|
|
|
|
|
+ var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
|
|
|
|
|
|
|
|
// Check filter
|
|
// Check filter
|
|
|
this.data = f ? $.grep(this.options.data, function (item, i) {
|
|
this.data = f ? $.grep(this.options.data, function (item, i) {
|
|
@@ -928,7 +928,7 @@
|
|
|
that.header.formatters[$.inArray(key, that.header.fields)],
|
|
that.header.formatters[$.inArray(key, that.header.fields)],
|
|
|
[value, item, i], value);
|
|
[value, item, i], value);
|
|
|
|
|
|
|
|
- if (! ($.inArray(key, that.header.fields) !== -1 &&
|
|
|
|
|
|
|
+ if (!($.inArray(key, that.header.fields) !== -1 &&
|
|
|
(typeof value === 'string' || typeof value === 'number') &&
|
|
(typeof value === 'string' || typeof value === 'number') &&
|
|
|
(value + '').toLowerCase().indexOf(fval) !== -1)) {
|
|
(value + '').toLowerCase().indexOf(fval) !== -1)) {
|
|
|
return false;
|
|
return false;
|
|
@@ -1039,7 +1039,7 @@
|
|
|
pageList = [];
|
|
pageList = [];
|
|
|
$.each(list, function (i, value) {
|
|
$.each(list, function (i, value) {
|
|
|
pageList.push(value.toUpperCase() === that.options.formatAllRows().toUpperCase() ?
|
|
pageList.push(value.toUpperCase() === that.options.formatAllRows().toUpperCase() ?
|
|
|
- that.options.formatAllRows() : +value);
|
|
|
|
|
|
|
+ that.options.formatAllRows() : +value);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1048,7 +1048,7 @@
|
|
|
var active;
|
|
var active;
|
|
|
if ($allSelected) {
|
|
if ($allSelected) {
|
|
|
active = page === that.options.formatAllRows() ? ' class="active"' : '';
|
|
active = page === that.options.formatAllRows() ? ' class="active"' : '';
|
|
|
- } else{
|
|
|
|
|
|
|
+ } else {
|
|
|
active = page === that.options.pageSize ? ' class="active"' : '';
|
|
active = page === that.options.pageSize ? ' class="active"' : '';
|
|
|
}
|
|
}
|
|
|
pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page));
|
|
pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page));
|
|
@@ -1157,7 +1157,7 @@
|
|
|
|
|
|
|
|
$this.parent().addClass('active').siblings().removeClass('active');
|
|
$this.parent().addClass('active').siblings().removeClass('active');
|
|
|
this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ?
|
|
this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ?
|
|
|
- this.options.formatAllRows() : +$this.text();
|
|
|
|
|
|
|
+ this.options.formatAllRows() : +$this.text();
|
|
|
this.$toolbar.find('.page-size').text(this.options.pageSize);
|
|
this.$toolbar.find('.page-size').text(this.options.pageSize);
|
|
|
|
|
|
|
|
this.updatePagination(event);
|
|
this.updatePagination(event);
|
|
@@ -1342,10 +1342,10 @@
|
|
|
.text(''));
|
|
.text(''));
|
|
|
|
|
|
|
|
selectControl.append($("<option></option>")
|
|
selectControl.append($("<option></option>")
|
|
|
- .attr("value",value)
|
|
|
|
|
|
|
+ .attr("value", value)
|
|
|
.text(value));
|
|
.text(value));
|
|
|
} else {
|
|
} else {
|
|
|
- for (; iOpt < options.length; iOpt++ ) {
|
|
|
|
|
|
|
+ for (; iOpt < options.length; iOpt++) {
|
|
|
if (options[iOpt].value === value) {
|
|
if (options[iOpt].value === value) {
|
|
|
exitsOpt = true;
|
|
exitsOpt = true;
|
|
|
break;
|
|
break;
|
|
@@ -1354,7 +1354,7 @@
|
|
|
|
|
|
|
|
if (!exitsOpt) {
|
|
if (!exitsOpt) {
|
|
|
selectControl.append($("<option></option>")
|
|
selectControl.append($("<option></option>")
|
|
|
- .attr("value",value)
|
|
|
|
|
|
|
+ .attr("value", value)
|
|
|
.text(value));
|
|
.text(value));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1539,64 +1539,64 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
BootstrapTable.prototype.initKeyEvents = function () {
|
|
BootstrapTable.prototype.initKeyEvents = function () {
|
|
|
- if (this.options.keyEvents) {
|
|
|
|
|
- var that = this;
|
|
|
|
|
- $(document).off('keypress').on('keypress', function (e) {
|
|
|
|
|
- var $search = that.$toolbar.find('.search input'),
|
|
|
|
|
- $refresh = that.$toolbar.find('button[name="refresh"]'),
|
|
|
|
|
- $toggle= that.$toolbar.find('button[name="toggle"]'),
|
|
|
|
|
- $paginationSwitch = that.$toolbar.find('button[name="paginationSwitch"]');
|
|
|
|
|
- switch (e.keyCode) {
|
|
|
|
|
- case 115://s
|
|
|
|
|
- case 83://S
|
|
|
|
|
- if (!that.options.search) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(document.activeElement === $search.get(0)){
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- $search.focus();
|
|
|
|
|
- return false;
|
|
|
|
|
- case 114: //r
|
|
|
|
|
- case 82: //R
|
|
|
|
|
- if (!that.options.showRefresh) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(document.activeElement === $search.get(0)){
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
- $refresh.click();
|
|
|
|
|
- return false;
|
|
|
|
|
- case 116: //t
|
|
|
|
|
- case 84: //T
|
|
|
|
|
- if (!that.options.showToggle) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(document.activeElement === $search.get(0)){
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $toggle.click();
|
|
|
|
|
- return false;
|
|
|
|
|
- case 112: //p
|
|
|
|
|
- case 80: //p
|
|
|
|
|
- if (!that.options.showPaginationSwitch) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(document.activeElement === $search.get(0)){
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $paginationSwitch.click();
|
|
|
|
|
- return false;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (this.options.keyEvents) {
|
|
|
|
|
+ var that = this;
|
|
|
|
|
+ $(document).off('keypress').on('keypress', function (e) {
|
|
|
|
|
+ var $search = that.$toolbar.find('.search input'),
|
|
|
|
|
+ $refresh = that.$toolbar.find('button[name="refresh"]'),
|
|
|
|
|
+ $toggle = that.$toolbar.find('button[name="toggle"]'),
|
|
|
|
|
+ $paginationSwitch = that.$toolbar.find('button[name="paginationSwitch"]');
|
|
|
|
|
+ switch (e.keyCode) {
|
|
|
|
|
+ case 115://s
|
|
|
|
|
+ case 83://S
|
|
|
|
|
+ if (!that.options.search) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (document.activeElement === $search.get(0)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ $search.focus();
|
|
|
|
|
+ return false;
|
|
|
|
|
+ case 114: //r
|
|
|
|
|
+ case 82: //R
|
|
|
|
|
+ if (!that.options.showRefresh) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (document.activeElement === $search.get(0)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ $refresh.click();
|
|
|
|
|
+ return false;
|
|
|
|
|
+ case 116: //t
|
|
|
|
|
+ case 84: //T
|
|
|
|
|
+ if (!that.options.showToggle) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (document.activeElement === $search.get(0)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $toggle.click();
|
|
|
|
|
+ return false;
|
|
|
|
|
+ case 112: //p
|
|
|
|
|
+ case 80: //p
|
|
|
|
|
+ if (!that.options.showPaginationSwitch) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (document.activeElement === $search.get(0)) {
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $paginationSwitch.click();
|
|
|
|
|
+ return false;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
BootstrapTable.prototype.getCaretHtml = function () {
|
|
BootstrapTable.prototype.getCaretHtml = function () {
|
|
@@ -1665,8 +1665,8 @@
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
$fixedHeader = that.$container.find('.fixed-table-header'),
|
|
$fixedHeader = that.$container.find('.fixed-table-header'),
|
|
|
- $fixedBody = that.$container.find('.fixed-table-body'),
|
|
|
|
|
- scrollWidth = that.$el.width() > $fixedBody.width() ? getScrollBarWidth() : 0;
|
|
|
|
|
|
|
+ $fixedBody = that.$container.find('.fixed-table-body'),
|
|
|
|
|
+ scrollWidth = that.$el.width() > $fixedBody.width() ? getScrollBarWidth() : 0;
|
|
|
|
|
|
|
|
that.$header_ = that.$header.clone(true, true);
|
|
that.$header_ = that.$header.clone(true, true);
|
|
|
that.$selectAll_ = that.$header_.find('[name="btSelectAll"]');
|
|
that.$selectAll_ = that.$header_.find('[name="btSelectAll"]');
|
|
@@ -1703,7 +1703,7 @@
|
|
|
|
|
|
|
|
$.each(this.options.columns, function (i, column) {
|
|
$.each(this.options.columns, function (i, column) {
|
|
|
var falign = '', // footer align style
|
|
var falign = '', // footer align style
|
|
|
- style = '',
|
|
|
|
|
|
|
+ style = '',
|
|
|
class_ = sprintf(' class="%s"', column['class']);
|
|
class_ = sprintf(' class="%s"', column['class']);
|
|
|
|
|
|
|
|
if (!column.visible) {
|
|
if (!column.visible) {
|
|
@@ -1727,7 +1727,7 @@
|
|
|
this.$footer.find('tr').html(html.join(''));
|
|
this.$footer.find('tr').html(html.join(''));
|
|
|
clearTimeout(this.timeoutFooter_);
|
|
clearTimeout(this.timeoutFooter_);
|
|
|
this.timeoutFooter_ = setTimeout($.proxy(this.fitFooter, this),
|
|
this.timeoutFooter_ = setTimeout($.proxy(this.fitFooter, this),
|
|
|
- this.$el.is(':hidden') ? 100: 0);
|
|
|
|
|
|
|
+ this.$el.is(':hidden') ? 100 : 0);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
BootstrapTable.prototype.fitFooter = function () {
|
|
BootstrapTable.prototype.fitFooter = function () {
|
|
@@ -1743,8 +1743,8 @@
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $fixedBody = this.$container.find('.fixed-table-body');
|
|
|
|
|
- elWidth = this.$el.css('width');
|
|
|
|
|
|
|
+ $fixedBody = this.$container.find('.fixed-table-body');
|
|
|
|
|
+ elWidth = this.$el.css('width');
|
|
|
scrollWidth = elWidth > $fixedBody.width() ? getScrollBarWidth() : 0;
|
|
scrollWidth = elWidth > $fixedBody.width() ? getScrollBarWidth() : 0;
|
|
|
|
|
|
|
|
this.$footer.css({
|
|
this.$footer.css({
|
|
@@ -1754,7 +1754,7 @@
|
|
|
|
|
|
|
|
$footerTd = this.$footer.find('td');
|
|
$footerTd = this.$footer.find('td');
|
|
|
|
|
|
|
|
- $fixedBody.find('tbody tr:first-child:not(.no-records-found) > td').each(function(i) {
|
|
|
|
|
|
|
+ $fixedBody.find('tbody tr:first-child:not(.no-records-found) > td').each(function (i) {
|
|
|
$footerTd.eq(i).outerWidth($(this).outerWidth());
|
|
$footerTd.eq(i).outerWidth($(this).outerWidth());
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
@@ -1784,12 +1784,12 @@
|
|
|
|
|
|
|
|
BootstrapTable.prototype.toggleRow = function (index, isIdField, visible) {
|
|
BootstrapTable.prototype.toggleRow = function (index, isIdField, visible) {
|
|
|
if (index === -1) {
|
|
if (index === -1) {
|
|
|
- return;
|
|
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $(this.$body[0]).children().filter(sprintf( isIdField ? '[value="%s"]' : '[data-index="%s"]', index))
|
|
|
|
|
|
|
+ $(this.$body[0]).children().filter(sprintf(isIdField ? '[value="%s"]' : '[data-index="%s"]', index))
|
|
|
[visible ? 'show' : 'hide']();
|
|
[visible ? 'show' : 'hide']();
|
|
|
- };
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
// PUBLIC FUNCTION DEFINITION
|
|
// PUBLIC FUNCTION DEFINITION
|
|
|
// =======================
|
|
// =======================
|