浏览代码

Add toggleView method.

zhixin 11 年之前
父节点
当前提交
e35f24b345
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/bootstrap-table.js

+ 8 - 1
src/bootstrap-table.js

@@ -1618,6 +1618,12 @@
         }
     };
 
+    BootstrapTable.prototype.toggleView = function () {
+        this.options.cardView = !this.options.cardView;
+        this.initHeader();
+        this.initBody();
+    };
+
     // BOOTSTRAP TABLE PLUGIN DEFINITION
     // =======================
 
@@ -1637,7 +1643,8 @@
         'filterBy',
         'scrollTo',
         'selectPage', 'prevPage', 'nextPage',
-        'togglePagination'
+        'togglePagination',
+        'toggleView'
     ];
 
     $.fn.bootstrapTable = function (option, _relatedTarget) {