Browse Source

Add toggleView method.

zhixin 11 years ago
parent
commit
e35f24b345
1 changed files with 8 additions and 1 deletions
  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
     // BOOTSTRAP TABLE PLUGIN DEFINITION
     // =======================
     // =======================
 
 
@@ -1637,7 +1643,8 @@
         'filterBy',
         'filterBy',
         'scrollTo',
         'scrollTo',
         'selectPage', 'prevPage', 'nextPage',
         'selectPage', 'prevPage', 'nextPage',
-        'togglePagination'
+        'togglePagination',
+        'toggleView'
     ];
     ];
 
 
     $.fn.bootstrapTable = function (option, _relatedTarget) {
     $.fn.bootstrapTable = function (option, _relatedTarget) {