Browse Source

Fix minimumCountColumns option init error.

zhixin 11 years ago
parent
commit
f27f278d90
2 changed files with 12 additions and 1 deletions
  1. 4 0
      README.md
  2. 8 1
      src/bootstrap-table.js

+ 4 - 0
README.md

@@ -24,6 +24,10 @@ Bootstrap table displays data in a tabular format and offers rich support to rad
 - [ ] Fix #131: Add pagination events.
 - [ ] Fix #144: onCheck and onUncheck functionalities are reversed when using `clickToSelect` option. (jQuery 1.7.2 bug).
 - [x] Apply `width` column option to row style.
+- [x] Add bootstrap-table-filter extension.
+- [x] Add czech translation.
+- [x] Fix minimumCountColumns option init error.
+
 
 ## Features
 

+ 8 - 1
src/bootstrap-table.js

@@ -463,7 +463,8 @@
             html = [],
             timeoutId = 0,
             $keepOpen,
-            $search;
+            $search,
+            switchableCount = 0;
 
         this.$toolbar = this.$container.find('.fixed-table-toolbar').html('');
 
@@ -507,6 +508,7 @@
                     html.push(sprintf('<li>' +
                         '<label><input type="checkbox" data-field="%s" value="%s"%s> %s</label>' +
                         '</li>', column.field, i, checked, column.title));
+                    switchableCount++;
                 }
             });
             html.push('</ul>',
@@ -535,6 +537,11 @@
 
         if (this.options.showColumns) {
             $keepOpen = this.$toolbar.find('.keep-open');
+
+            if (switchableCount <= this.options.minimumCountColumns) {
+                $keepOpen.find('input').prop('disabled', true);
+            }
+
             $keepOpen.find('li').off('click').on('click', function (event) {
                 event.stopImmediatePropagation();
             });