diff --git a/src/assets/plugins/bootstrap-table/js/bootstrap-table.js b/src/assets/plugins/bootstrap-table/js/bootstrap-table.js index 3986ec6..1394649 100644 --- a/src/assets/plugins/bootstrap-table/js/bootstrap-table.js +++ b/src/assets/plugins/bootstrap-table/js/bootstrap-table.js @@ -2203,8 +2203,10 @@ fixedScroll = data.fixedScroll; data = data[this.options.dataField]; } else if (!$.isArray(data)) { // support fixedScroll - fixedScroll = data.fixedScroll; - data = data.data; + if (data) { + fixedScroll = data.fixedScroll; + data = data.data; + } } this.initData(data); @@ -2528,13 +2530,18 @@ }; BootstrapTable.prototype.destroy = function () { + let bootstrapTable = $('div .bootstrap-table'); + if (bootstrapTable.length > 1) { + this.$container = $(bootstrapTable[0]); + this.options.toolbar = $('div.fixed-table-toolbar > div.bars.pull-left').html(); + } this.$el.insertBefore(this.$container); - $(this.options.toolbar).insertBefore(this.$el); - this.$container.next().remove(); - this.$container.remove(); - this.$el.html(this.$el_.html()) - .css('margin-top', '0') - .attr('class', this.$el_.attr('class') || ''); // reset the class + $(this.options.toolbar).insertBefore(this.$el); + this.$container.next().remove(); + this.$container.remove(); + this.$el.html(this.$el_.html()) + .css('margin-top', '0') + .attr('class', this.$el_.attr('class') || ''); // reset the class }; BootstrapTable.prototype.showLoading = function () { @@ -2776,12 +2783,17 @@ data = $this.data('bootstrap.table'), options = $.extend({}, BootstrapTable.DEFAULTS, $this.data(), typeof option === 'object' && option); - + if (typeof option === 'string') { if ($.inArray(option, allowedMethods) < 0) { throw new Error("Unknown method: " + option); } + if (!data && option === 'destroy') { + new BootstrapTable(this, options).destroy(); + return; + } + if (!data) { return; }