浏览代码

Fixed columnsSearch non-unique id warning (#5164)

文翼 5 年之前
父节点
当前提交
bd72ac4033
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 1 0
      CHANGELOG.md
  2. 2 2
      src/bootstrap-table.js

+ 1 - 0
CHANGELOG.md

@@ -31,6 +31,7 @@ ChangeLog
 - **Update:** Fixed `font-size` of the loading text.
 - **Update:** Fixed table `border` bug when table is hidden.
 - **Update:** Fixed `showRow` method show all hidden rows bug.
+- **Update:** Fixed columnsSearch non-unique id warning.
 - **Remove:** Removed the `onlyInfoPagination` option.
 - **Remove:** Removed accent neutralise extension and moved it to core.
 

+ 2 - 2
src/bootstrap-table.js

@@ -589,7 +589,7 @@ class BootstrapTable {
         if (opts.showColumnsSearch) {
           html.push(
             Utils.sprintf(this.constants.html.toolbarDropdownItem,
-              Utils.sprintf('<input type="text" class="%s" id="columnsSearch" placeholder="%s" autocomplete="off">', this.constants.classes.input, opts.formatSearch())
+              Utils.sprintf('<input type="text" class="%s" name="columnsSearch" placeholder="%s" autocomplete="off">', this.constants.classes.input, opts.formatSearch())
             )
           )
           html.push(this.constants.html.toolbarDropdownSeparator)
@@ -702,7 +702,7 @@ class BootstrapTable {
       })
 
       if (opts.showColumnsSearch) {
-        const $columnsSearch = $keepOpen.find('#columnsSearch')
+        const $columnsSearch = $keepOpen.find('[name="columnsSearch"]')
         const $listItems = $keepOpen.find('.dropdown-item-marker')
         $columnsSearch.on('keyup paste change', ({currentTarget}) => {
           const $this = $(currentTarget)