Browse Source

Fix #446, #649: Added class to remove table-bordered style.

zhixin 10 years ago
parent
commit
d5b9df365c
4 changed files with 20 additions and 8 deletions
  1. 1 0
      CHANGELOG.md
  2. 1 1
      docs/_i18n/en/documentation/table-options.md
  3. 15 7
      src/bootstrap-table.css
  4. 3 0
      src/bootstrap-table.js

+ 1 - 0
CHANGELOG.md

@@ -13,6 +13,7 @@
 - [bug] Fix #279: scrollWidth bug.
 - [enh] `getData` method support to get the current page data.
 - [enh] Added `ro-RO` locale.
+- [enh] Added `table-no-bordered` class to remove table-bordered style.
 
 ### 1.7.0
 

+ 1 - 1
docs/_i18n/en/documentation/table-options.md

@@ -31,7 +31,7 @@ The table options is defined in `jQuery.fn.bootstrapTable.defaults`.
         <td>data-classes</td>
         <td>String</td>
         <td>'table table-hover'</td>
-        <td>The class name of table.</td>
+        <td>The class name of table. By default, the table is bordered, you can add 'table-no-bordered' to remove table-bordered style.</td>
     </tr>
     <tr>
         <td>height</td>

+ 15 - 7
src/bootstrap-table.css

@@ -11,16 +11,20 @@
     border-radius: 1px;
 }
 
-.bootstrap-table
-.table,
-.table > tbody > tr > th,
-.table > tfoot > tr > th,
-.table > thead > tr > td,
-.table > tbody > tr > td,
-.table > tfoot > tr > td {
+.bootstrap-table .table,
+.bootstrap-table .table > tbody > tr > th,
+.bootstrap-table .table > tfoot > tr > th,
+.bootstrap-table .table > thead > tr > td,
+.bootstrap-table .table > tbody > tr > td,
+.bootstrap-table .table > tfoot > tr > td {
     padding: 8px !important;
 }
 
+.bootstrap-table .table.table-no-bordered > thead > tr > th,
+.bootstrap-table .table.table-no-bordered > tbody > tr > td {
+    border-right: 2px solid transparent;
+}
+
 .fixed-table-container {
     position: relative;
     clear: both;
@@ -30,6 +34,10 @@
     -moz-border-radius: 4px;
 }
 
+.fixed-table-container.table-no-bordered {
+    border: 1px solid transparent;
+}
+
 .fixed-table-footer,
 .fixed-table-header {
     height: 37px; /*cellHeight*/

+ 3 - 0
src/bootstrap-table.js

@@ -394,6 +394,9 @@
         if (this.options.striped) {
             this.$el.addClass('table-striped');
         }
+        if ($.inArray('table-no-bordered', this.options.classes.split(' ')) !== -1) {
+            this.$container.find('.fixed-table-container').addClass('table-no-bordered');
+        }
     };
 
     BootstrapTable.prototype.initTable = function () {