Browse Source

Fixed multiple sort not destroy bug (#4811)

Co-authored-by: Dennis Hernández <dennishernandezvargas@gmail.com>
文翼 5 years ago
parent
commit
61d652fd04
1 changed files with 10 additions and 1 deletions
  1. 10 1
      src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

+ 10 - 1
src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

@@ -236,7 +236,7 @@ const bootstrap = {
                     </table>
                 </div>
               </div>
-              
+
               <button class="waves-effect waves-light button" data-close aria-label="Close modal" type="button">
                 <span aria-hidden="true">%s</span>
               </button>
@@ -488,6 +488,7 @@ $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales)
 
 const BootstrapTable = $.fn.bootstrapTable.Constructor
 const _initToolbar = BootstrapTable.prototype.initToolbar
+const _destroy = BootstrapTable.prototype.destroy
 
 BootstrapTable.prototype.initToolbar = function (...args) {
   this.showToolbar = this.showToolbar || this.options.showMultiSort
@@ -584,6 +585,14 @@ BootstrapTable.prototype.initToolbar = function (...args) {
   }
 }
 
+BootstrapTable.prototype.destroy = function (...args) {
+  _destroy.apply(this, Array.prototype.slice.apply(args))
+
+  if (this.options.showMultiSort) {
+    this.$sortModal.remove()
+  }
+}
+
 BootstrapTable.prototype.multipleSort = function () {
   const that = this
   if (!isSingleSort && that.options.sortPriority !== null && typeof that.options.sortPriority === 'object' && that.options.sidePagination !== 'server') {