Browse Source

Merge pull request #28 from wenzhixin/master

Update my repo
Dennis Hernández 10 years ago
parent
commit
01afc1f7ab

+ 9 - 1
docs/_i18n/en/extensions/cookie.md

@@ -27,4 +27,12 @@ Use Plugin: [bootstrap-table-cookie](https://github.com/wenzhixin/bootstrap-tabl
 
 * type: String
 * description: You must set this property if stateSave is enable to sets an unique cookie with an identifier for each table in your page or project. You must set this property because we need create cookies with an identifier.
-* default: ``
+* default: ``
+
+## This plugin saves
+
+* Sort order
+* Page number
+* Page number from the list
+* Visible columns
+* Search text

+ 9 - 1
docs/_i18n/es/extensions/cookie.md

@@ -27,4 +27,12 @@ Use Plugin: [bootstrap-table-cookie](https://github.com/wenzhixin/bootstrap-tabl
 
 * type: String
 * description: You must set this property if stateSave is enable to sets an unique cookie with an identifier for each table in your page or project. You must set this property because we need create cookies with an identifier.
-* default: ``
+* default: ``
+
+## This plugin saves
+
+* Sort order
+* Page number
+* Page number from the list
+* Visible columns
+* Search text

+ 9 - 1
docs/_i18n/zh-cn/extensions/cookie.md

@@ -27,4 +27,12 @@ Use Plugin: [bootstrap-table-cookie](https://github.com/wenzhixin/bootstrap-tabl
 
 * type: String
 * description: You must set this property if stateSave is enable to sets an unique cookie with an identifier for each table in your page or project. You must set this property because we need create cookies with an identifier.
-* default: ``
+* default: ``
+
+## This plugin saves
+
+* Sort order
+* Page number
+* Page number from the list
+* Visible columns
+* Search text

+ 8 - 1
docs/assets/js/sidenav.js

@@ -27,7 +27,8 @@
     initViews: function() {
       var that = this,
           counts = {},
-          preLevel = 0;
+          preLevel = 0,
+          parentId = '';
 
       this.$menu = $([
           '<div class="bs-sidebar hidden-print">',
@@ -76,6 +77,9 @@
           id = $.trim($(this).text()).toLowerCase();
           id = id.replace(/ /g, '-');
           id = id.replace(/'|"/g, '');
+          if (level === 2) {
+            id = parentId + '-' + id;
+          }
         }
         $div = $('<div id="' + id + '"></div>');
         $div.insertAfter($this).append($this);
@@ -93,6 +97,9 @@
           }
           that.$list += '<li>' + aElem;
         }
+        if (level === 1) {
+          parentId = id;
+        }
         preLevel = level;
       });
 

+ 16 - 5
src/bootstrap-table.js

@@ -113,6 +113,16 @@
         return text;
     };
 
+    var getRealHeight = function ($el) {
+        var height = 0;
+        $el.children().each(function () {
+            if (height < $(this).outerHeight(true)) {
+                height = $(this).outerHeight(true);
+            }
+        });
+        return height;
+    };
+
     // BOOTSTRAP TABLE CLASS DEFINITION
     // ======================
 
@@ -483,13 +493,14 @@
                     }
                 }
             }
+            if (column.width && typeof column.width === 'string') {
+                column.width = column.width.replace('%', '').replace('px', '');
+            }
 
             halign = sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
             align = sprintf('text-align: %s; ', column.align);
             style = sprintf('vertical-align: %s; ', column.valign);
-            style += sprintf('width: %s%s; ', column.checkbox || column.radio ? 36 :
-                (column.width ? column.width.replace('%', '').replace('px', '') : undefined),
-                unitWidth);
+            style += sprintf('width: %s%s; ', column.checkbox || column.radio ? 36 : column.width, unitWidth);
 
             visibleColumns.push(column);
             that.header.fields.push(column.field);
@@ -1748,8 +1759,8 @@
             this.$selectItem.length === this.$selectItem.filter(':checked').length);
 
         if (this.options.height) {
-            var toolbarHeight = +this.$toolbar.children().outerHeight(true),
-                paginationHeight = +this.$pagination.children().outerHeight(true),
+            var toolbarHeight = getRealHeight(this.$toolbar),
+                paginationHeight = getRealHeight(this.$pagination),
                 height = this.options.height - toolbarHeight - paginationHeight;
 
             $tableContainer.css('height', height + 'px');