';
sModal += '
';
@@ -56,7 +55,7 @@
$('body').append($(sModal));
- that.$sortModal = $(_selector);
+ that.$sortModal = $(sortModalId);
var $rows = that.$sortModal.find('tbody > tr');
that.$sortModal.off('click', '#add').on('click', '#add', function() {
@@ -104,7 +103,7 @@
var sorted_fields = fields.sort();
for (var i = 0; i < fields.length - 1; i++) {
- if (sorted_fields[i + 1] == sorted_fields[i]) {
+ if (sorted_fields[i + 1] === sorted_fields[i]) {
results.push(sorted_fields[i]);
}
}
@@ -224,8 +223,18 @@
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
var BootstrapTable = $.fn.bootstrapTable.Constructor,
+ _initSort = BootstrapTable.prototype.initSort,
_initToolbar = BootstrapTable.prototype.initToolbar;
+ BootstrapTable.prototype.initSort = function() {
+ var that = this;
+ if (!isSingleSort && that.options.sortPriority !== null && typeof that.options.sortPriority === 'object') {
+ that.onMultipleSort();
+ } else {
+ _initSort.apply(this, Array.prototype.slice.apply(arguments));
+ }
+ }
+
BootstrapTable.prototype.initToolbar = function() {
this.showToolbar = true;
var that = this,
@@ -245,7 +254,7 @@
$btnGroup.append($multiSortBtn);
- showSortModal(that);
+ showSortModal(that, sortModalId);
}
this.$el.on('sort.bs.table', function() {
@@ -271,7 +280,7 @@
that.assignSortableArrows();
that.$sortModal.remove();
- showSortModal(that);
+ showSortModal(that, sortModalId);
});
this.$el.on('reset-view.bs.table', function() {
@@ -355,8 +364,8 @@
});
if (sortPriority !== undefined) {
- $multiSortName.find('option[value="' + sortPriority.sortName + '"]').attr("selected", true);
- $multiSortOrder.find('option[value="' + sortPriority.sortOrder + '"]').attr("selected", true);
+ $multiSortName.find('option[value="' + sortPriority.sortName + '"]').attr('selected', true);
+ $multiSortOrder.find('option[value="' + sortPriority.sortOrder + '"]').attr('selected', true);
}
};
@@ -377,7 +386,7 @@
var total = this.$sortModal.find('.multi-sort-name:first option').length,
current = this.$sortModal.find('tbody tr').length;
- if (current == total) {
+ if (current === total) {
this.$sortModal.find('#add').attr('disabled', 'disabled');
}
if (current > 1) {
@@ -386,8 +395,8 @@
if (current < total) {
this.$sortModal.find('#add').removeAttr('disabled');
}
- if (current == 1) {
+ if (current === 1) {
this.$sortModal.find('#delete').attr('disabled', 'disabled');
}
};
-})(jQuery);
\ No newline at end of file
+})(jQuery);