浏览代码

Fixed showColumns cannot work of foundation theme

zhixin 5 年之前
父节点
当前提交
b772e6a825

+ 1 - 0
CHANGELOG.md

@@ -26,6 +26,7 @@ ChangeLog
 - **Update:** Fixed `removeAll` bug in the last page when sidePagination is server.
 - **Update:** Fixed `search` not always trigger in IE11 bug.
 - **Update:** Fixed `search` width `escape` bug.
+- **Update:** Fixed `showColumns` cannot work of foundation theme.
 - **Update:** Fixed `showFullscreen` bug when setting height.
 - **Update:** Fixed `sort` cannot work after searching.
 - **Update:** Fixed `sortable` style error when using `table-sm`.

+ 5 - 1
src/themes/foundation/bootstrap-table-foundation.js

@@ -76,8 +76,12 @@ $.BootstrapTable = class extends $.BootstrapTable {
     $dropdowns.off('click').on('click', e => {
       const $this = $(e.currentTarget)
       e.stopPropagation()
-      $dropdowns.not($this).next().foundation('close')
+
       $this.next().foundation('toggle')
+
+      if ($dropdowns.not($this).length) {
+        $dropdowns.not($this).next().foundation('close')
+      }
     })
 
     $(document).off('click.bs.dropdown.foundation').on('click.bs.dropdown.foundation', () => {

+ 11 - 13
src/themes/foundation/bootstrap-table-foundation.scss

@@ -21,22 +21,20 @@
       height: 2.5293rem;
     }
 
-    .keep-open {
-      .dropdown-container {
-        .button {
-          &:hover .menu {
-            background: #fff;
-          }
+    .keep-open.dropdown-container {
+      .button {
+        &:hover .menu {
+          background: #fff;
         }
+      }
 
-        .menu {
-          li {
-            padding: 5px 0;
+      .menu {
+        li {
+          padding: 5px 0;
 
-            label {
-              white-space: nowrap;
-              text-align: left;
-            }
+          label {
+            white-space: nowrap;
+            text-align: left;
           }
         }
       }