ソースを参照

Update bootstrap-table-resizable

zhixin 10 年 前
コミット
d07eb7861c
1 ファイル変更8 行追加32 行削除
  1. 8 32
      src/extensions/resizable/bootstrap-table-resizable.js

+ 8 - 32
src/extensions/resizable/bootstrap-table-resizable.js

@@ -7,14 +7,12 @@
 (function ($) {
     'use strict';
 
-    var initResizable = function (el) {
-        var that = el;
-
+    var initResizable = function (that) {
         //Deletes the plugin to re-create it
-        $(el.$el).colResizable({disable: true});
+        that.$el.colResizable({disable: true});
 
         //Creates the plugin
-        $(el.$el).colResizable({
+        that.$el.colResizable({
             liveDrag: that.options.liveDrag,
             fixed: that.options.fixed,
             headerOnly: that.options.headerOnly,
@@ -43,46 +41,24 @@
     });
 
     var BootstrapTable = $.fn.bootstrapTable.Constructor,
-        _init = BootstrapTable.prototype.init,
-        _toggleColumn = BootstrapTable.prototype.toggleColumn,
         _toggleView = BootstrapTable.prototype.toggleView,
         _resetView = BootstrapTable.prototype.resetView;
 
-    BootstrapTable.prototype.init = function () {
-        _init.apply(this, Array.prototype.slice.apply(arguments));
-
-        if (this.options.resizable) {
-            initResizable(this);
-        }
-    };
-
-    BootstrapTable.prototype.toggleColumn = function () {
-        _toggleColumn.apply(this, Array.prototype.slice.apply(arguments));
-
-        if (this.options.resizable) {
-            initResizable(this);
-        }
-    };
-
     BootstrapTable.prototype.toggleView = function () {
         _toggleView.apply(this, Array.prototype.slice.apply(arguments));
 
-        if (this.options.resizable) {
-            if (this.options.cardView) {
-                //Deletes the plugin
-                $(this.$el).colResizable({disable: true});
-                return;
-            }
-            initResizable(this);
+        if (this.options.resizable && this.options.cardView) {
+            //Deletes the plugin
+            $(this.$el).colResizable({disable: true});
         }
     };
 
     BootstrapTable.prototype.resetView = function () {
-        _resetView.apply(this, Array.prototype.slice.apply(arguments));
-
         if (this.options.resizable) {
             initResizable(this);
         }
+
+        _resetView.apply(this, Array.prototype.slice.apply(arguments));
     };
 
     BootstrapTable.prototype.onResize = function (e) {