|
@@ -11,16 +11,16 @@
|
|
|
var isSingleSort = false;
|
|
var isSingleSort = false;
|
|
|
|
|
|
|
|
var showSortModal = function(that) {
|
|
var showSortModal = function(that) {
|
|
|
- var _selector = that.$sortModal.selector,
|
|
|
|
|
- _id = _selector.substr(1);
|
|
|
|
|
|
|
+ var _selector = that.sortModalSelector,
|
|
|
|
|
+ _id = '#' + _selector;
|
|
|
|
|
|
|
|
if (!$(_id).hasClass("modal")) {
|
|
if (!$(_id).hasClass("modal")) {
|
|
|
- var sModal = ' <div class="modal fade" id="' + _id + '" tabindex="-1" role="dialog" aria-labelledby="' + _id + 'Label" aria-hidden="true">';
|
|
|
|
|
|
|
+ var sModal = ' <div class="modal fade" id="' + _selector + '" tabindex="-1" role="dialog" aria-labelledby="' + _selector + 'Label" aria-hidden="true">';
|
|
|
sModal += ' <div class="modal-dialog">';
|
|
sModal += ' <div class="modal-dialog">';
|
|
|
sModal += ' <div class="modal-content">';
|
|
sModal += ' <div class="modal-content">';
|
|
|
sModal += ' <div class="modal-header">';
|
|
sModal += ' <div class="modal-header">';
|
|
|
sModal += ' <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>';
|
|
sModal += ' <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>';
|
|
|
- sModal += ' <h4 class="modal-title" id="' + _id + 'Label">' + that.options.formatMultipleSort() + '</h4>';
|
|
|
|
|
|
|
+ sModal += ' <h4 class="modal-title" id="' + _selector + 'Label">' + that.options.formatMultipleSort() + '</h4>';
|
|
|
sModal += ' </div>';
|
|
sModal += ' </div>';
|
|
|
sModal += ' <div class="modal-body">';
|
|
sModal += ' <div class="modal-body">';
|
|
|
sModal += ' <div class="bootstrap-table">';
|
|
sModal += ' <div class="bootstrap-table">';
|
|
@@ -56,7 +56,7 @@
|
|
|
|
|
|
|
|
$('body').append($(sModal));
|
|
$('body').append($(sModal));
|
|
|
|
|
|
|
|
- that.$sortModal = $(_selector);
|
|
|
|
|
|
|
+ that.$sortModal = $(_id);
|
|
|
var $rows = that.$sortModal.find('tbody > tr');
|
|
var $rows = that.$sortModal.find('tbody > tr');
|
|
|
|
|
|
|
|
that.$sortModal.off('click', '#add').on('click', '#add', function() {
|
|
that.$sortModal.off('click', '#add').on('click', '#add', function() {
|
|
@@ -161,8 +161,11 @@
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ $.fn.bootstrapTable.methods.push('multipleSort');
|
|
|
|
|
+
|
|
|
$.extend($.fn.bootstrapTable.defaults, {
|
|
$.extend($.fn.bootstrapTable.defaults, {
|
|
|
showMultiSort: false,
|
|
showMultiSort: false,
|
|
|
|
|
+ showMultiSortButton: true,
|
|
|
sortPriority: null,
|
|
sortPriority: null,
|
|
|
onMultipleSort: function() {
|
|
onMultipleSort: function() {
|
|
|
return false;
|
|
return false;
|
|
@@ -229,8 +232,10 @@
|
|
|
BootstrapTable.prototype.initToolbar = function() {
|
|
BootstrapTable.prototype.initToolbar = function() {
|
|
|
this.showToolbar = true;
|
|
this.showToolbar = true;
|
|
|
var that = this,
|
|
var that = this,
|
|
|
- sortModalId = '#sortModal_' + this.$el.attr('id');
|
|
|
|
|
|
|
+ sortModalSelector = 'sortModal_' + this.$el.attr('id'),
|
|
|
|
|
+ sortModalId = '#' + sortModalSelector;
|
|
|
this.$sortModal = $(sortModalId);
|
|
this.$sortModal = $(sortModalId);
|
|
|
|
|
+ this.sortModalSelector = sortModalSelector;
|
|
|
|
|
|
|
|
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
|
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
|
|
|
|
|
|
@@ -238,7 +243,7 @@
|
|
|
var $btnGroup = this.$toolbar.find('>.btn-group').first(),
|
|
var $btnGroup = this.$toolbar.find('>.btn-group').first(),
|
|
|
$multiSortBtn = this.$toolbar.find('div.multi-sort');
|
|
$multiSortBtn = this.$toolbar.find('div.multi-sort');
|
|
|
|
|
|
|
|
- if (!$multiSortBtn.length) {
|
|
|
|
|
|
|
+ if (!$multiSortBtn.length && this.options.showMultiSortButton) {
|
|
|
$multiSortBtn = ' <button class="multi-sort btn btn-default' + (this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) + '" type="button" data-toggle="modal" data-target="' + sortModalId + '" title="' + this.options.formatMultipleSort() + '">';
|
|
$multiSortBtn = ' <button class="multi-sort btn btn-default' + (this.options.iconSize === undefined ? '' : ' btn-' + this.options.iconSize) + '" type="button" data-toggle="modal" data-target="' + sortModalId + '" title="' + this.options.formatMultipleSort() + '">';
|
|
|
$multiSortBtn += ' <i class="' + this.options.iconsPrefix + ' ' + this.options.icons.sort + '"></i>';
|
|
$multiSortBtn += ' <i class="' + this.options.iconsPrefix + ' ' + this.options.icons.sort + '"></i>';
|
|
|
$multiSortBtn += '</button>';
|
|
$multiSortBtn += '</button>';
|
|
@@ -282,6 +287,13 @@
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ BootstrapTable.prototype.multipleSort = function() {
|
|
|
|
|
+ var that = this;
|
|
|
|
|
+ if (!isSingleSort && that.options.sortPriority !== null && typeof that.options.sortPriority === 'object' && that.options.sidePagination !== 'server') {
|
|
|
|
|
+ that.onMultipleSort();
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
BootstrapTable.prototype.onMultipleSort = function() {
|
|
BootstrapTable.prototype.onMultipleSort = function() {
|
|
|
var that = this;
|
|
var that = this;
|
|
|
|
|
|