ソースを参照

Added the initData handler

Dennis Hernández 10 年 前
コミット
f27e4e02b5
1 ファイル変更15 行追加1 行削除
  1. 15 1
      src/extensions/flatJSON/bootstrap-table-flatJSON.js

+ 15 - 1
src/extensions/flatJSON/bootstrap-table-flatJSON.js

@@ -40,7 +40,8 @@
     });
 
     var BootstrapTable = $.fn.bootstrapTable.Constructor,
-        _initTable = BootstrapTable.prototype.initTable;
+        _initTable = BootstrapTable.prototype.initTable,
+        _initData = BootstrapTable.prototype.initData ;
 
     BootstrapTable.prototype.initTable = function () {
 
@@ -55,6 +56,19 @@
         _initTable.apply(this, Array.prototype.slice.apply(arguments));
     };
 
+    BootstrapTable.prototype.initData = function () {
+
+        //If the flat is true
+        if (this.options.flat) {
+            this.options.data = sd.flatHelper(this.options.data);
+        }
+        if (this.options.sidePagination === 'server') {
+            this.data = this.options.data;
+        }
+
+        _initData.apply(this, Array.prototype.slice.apply(arguments));
+    };
+
     //Main functions
     var sd = {
         flat: function (element) {