From b772e6a825f57e4ea5d749ea06573badfd15d4b1 Mon Sep 17 00:00:00 2001 From: zhixin Date: Sun, 9 Feb 2020 19:09:14 +0800 Subject: [PATCH] Fixed showColumns cannot work of foundation theme --- CHANGELOG.md | 1 + .../foundation/bootstrap-table-foundation.js | 6 ++++- .../bootstrap-table-foundation.scss | 24 +++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf983739f0..6a4d263f87 100644 --- a/CHANGELOG.md +++ b/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`. diff --git a/src/themes/foundation/bootstrap-table-foundation.js b/src/themes/foundation/bootstrap-table-foundation.js index b3ed4c3e76..0e98766003 100644 --- a/src/themes/foundation/bootstrap-table-foundation.js +++ b/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', () => { diff --git a/src/themes/foundation/bootstrap-table-foundation.scss b/src/themes/foundation/bootstrap-table-foundation.scss index 92ba7e02c3..0ae93a402d 100644 --- a/src/themes/foundation/bootstrap-table-foundation.scss +++ b/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; } } }