Browse Source

Added an option to show a search button and an clear filter button (#4385)

* updated check locale tool to see errors better

* Added an option to show a search button and an clear filter button

* revert unwanted change

* Using Spanish text
Dustin Utecht 6 years ago
parent
commit
609f0b82a1
54 changed files with 251 additions and 219 deletions
  1. 6 0
      site/docs/api/localizations.md
  2. 29 0
      site/docs/api/table-options.md
  3. 0 10
      site/docs/extensions/filter-control.md
  4. 24 10
      src/bootstrap-table.js
  5. 22 7
      src/constants/index.js
  6. 8 46
      src/extensions/filter-control/bootstrap-table-filter-control.js
  7. 3 3
      src/locale/bootstrap-table-af-ZA.js
  8. 3 3
      src/locale/bootstrap-table-ar-SA.js
  9. 3 3
      src/locale/bootstrap-table-ca-ES.js
  10. 3 3
      src/locale/bootstrap-table-cs-CZ.js
  11. 3 3
      src/locale/bootstrap-table-da-DK.js
  12. 3 3
      src/locale/bootstrap-table-de-DE.js
  13. 3 3
      src/locale/bootstrap-table-el-GR.js
  14. 3 3
      src/locale/bootstrap-table-en-US.js
  15. 3 3
      src/locale/bootstrap-table-es-AR.js
  16. 3 3
      src/locale/bootstrap-table-es-CL.js
  17. 3 3
      src/locale/bootstrap-table-es-CR.js
  18. 3 3
      src/locale/bootstrap-table-es-ES.js
  19. 3 3
      src/locale/bootstrap-table-es-MX.js
  20. 3 3
      src/locale/bootstrap-table-es-NI.js
  21. 3 3
      src/locale/bootstrap-table-es-SP.js
  22. 3 3
      src/locale/bootstrap-table-et-EE.js
  23. 3 3
      src/locale/bootstrap-table-eu-EU.js
  24. 3 3
      src/locale/bootstrap-table-fa-IR.js
  25. 3 3
      src/locale/bootstrap-table-fi-FI.js
  26. 3 3
      src/locale/bootstrap-table-fr-BE.js
  27. 3 3
      src/locale/bootstrap-table-fr-FR.js
  28. 3 3
      src/locale/bootstrap-table-he-IL.js
  29. 3 3
      src/locale/bootstrap-table-hr-HR.js
  30. 3 3
      src/locale/bootstrap-table-hu-HU.js
  31. 3 3
      src/locale/bootstrap-table-id-ID.js
  32. 3 3
      src/locale/bootstrap-table-it-IT.js
  33. 3 3
      src/locale/bootstrap-table-ja-JP.js
  34. 3 3
      src/locale/bootstrap-table-ka-GE.js
  35. 3 3
      src/locale/bootstrap-table-ko-KR.js
  36. 3 3
      src/locale/bootstrap-table-ms-MY.js
  37. 3 3
      src/locale/bootstrap-table-nb-NO.js
  38. 3 3
      src/locale/bootstrap-table-nl-NL.js
  39. 3 3
      src/locale/bootstrap-table-pl-PL.js
  40. 3 3
      src/locale/bootstrap-table-pt-BR.js
  41. 3 3
      src/locale/bootstrap-table-pt-PT.js
  42. 3 3
      src/locale/bootstrap-table-ro-RO.js
  43. 3 3
      src/locale/bootstrap-table-ru-RU.js
  44. 3 3
      src/locale/bootstrap-table-sk-SK.js
  45. 3 3
      src/locale/bootstrap-table-sv-SE.js
  46. 3 3
      src/locale/bootstrap-table-th-TH.js
  47. 3 3
      src/locale/bootstrap-table-tr-TR.js
  48. 3 3
      src/locale/bootstrap-table-uk-UA.js
  49. 3 3
      src/locale/bootstrap-table-ur-PK.js
  50. 3 3
      src/locale/bootstrap-table-uz-Latn-UZ.js
  51. 3 3
      src/locale/bootstrap-table-vi-VN.js
  52. 3 3
      src/locale/bootstrap-table-zh-CN.js
  53. 3 3
      src/locale/bootstrap-table-zh-TW.js
  54. 21 5
      tools/check-locale.js

+ 6 - 0
site/docs/api/localizations.md

@@ -78,6 +78,12 @@ $('#table').bootstrapTable({
 
 - **Default:** `'Search'`
 
+## formatClearSearch
+
+- **Parameter:** `undefined`
+
+- **Default:** `'Clear Search'`
+
 ## formatNoMatches
 
 - **Parameter:** `undefined`

+ 29 - 0
site/docs/api/table-options.md

@@ -794,6 +794,35 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 - **Example:** [Strict Search](https://examples.bootstrap-table.com/#options/strict-search.html)
 
+## showSearchButton
+
+- **Attribute:** `data-show-search-button`
+
+- **Type:** `Boolean`
+
+- **Detail:**
+
+  Set `true` to show a search Button behind the search input.
+  The Search will only be executed if the button is pressed (e.g. to prevent traffic or loading time).
+
+- **Default:** `false`
+
+- **Example:** [ShowSearchButton](https://examples.bootstrap-table.com/#options/show-search-button.html)
+
+## showSearchClearButton
+
+- **Attribute:** `data-show-search-clear-button`
+
+- **Type:** `Boolean`
+
+- **Detail:**
+
+  Set `true` to show a clear Button behind the search input which will clear the search input (also all filter from filter-control (if enabled)).
+
+- **Default:** `false`
+
+- **Example:** [ShowSearchClearButton](https://examples.bootstrap-table.com/#options/show-search-clear-button.html)
+
 ## trimOnSearch
 
 - **Attribute:** `data-trim-on-search`

+ 0 - 10
site/docs/extensions/filter-control.md

@@ -29,16 +29,6 @@ Dependence if you use the datepicker option: [bootstrap-datepicker](https://gith
 
 - **Default:** `false`
 
-### filterShowClear
-
-- **type:** `Boolean`
-
-- **Detail:**
-
-   Set true to add a button to clear all the controls added by this plugin.
-
-- **Default:** `false`
-
 ### alignmentSelectControlOptions
 
 - **type:** `String`

+ 24 - 10
src/bootstrap-table.js

@@ -597,14 +597,24 @@ class BootstrapTable {
 
     if (o.search) {
       html = []
-      html.push(`<div class="${this.constants.classes.pull}-${o.searchAlign} search ${this.constants.classes.inputGroup}">
-        <input class="${this.constants.classes.input}${Utils.sprintf(' input-%s', o.iconSize)}"
-        type="text" placeholder="${o.formatSearch()}">
-        </div>`)
+
+
+      html.push(Utils.sprintf(`
+        <div class="${this.constants.classes.pull}-${o.searchAlign} search ${this.constants.classes.inputGroup}">
+            %s
+        </div>
+      `,
+      Utils.sprintf(this.constants.html.inputGroup,
+        `<input class="${this.constants.classes.input}${Utils.sprintf(' input-%s', o.iconSize)}" type="text" placeholder="${o.formatSearch()}">`,
+        (o.showSearchButton ? Utils.sprintf(this.constants.html.searchButton, o.formatSearch(), this.options.iconsPrefix, this.options.icons.search) : '') +
+        (o.showSearchClearButton ? Utils.sprintf(this.constants.html.searchClearButton, o.formatClearSearch(), this.options.iconsPrefix, this.options.icons.clearSearch) : ''))
+      ))
 
       this.$toolbar.append(html.join(''))
-      $search = this.$toolbar.find('.search input')
-      $search.off('keyup drop blur').on('keyup drop blur', event => {
+      const $searchInput = this.$toolbar.find('.search input')
+      $search = o.showSearchButton ? this.$toolbar.find('.search button[name=search]') : $searchInput
+      const eventTriggers = o.showSearchButton ? 'click' : 'keyup drop blur'
+      $search.off(eventTriggers).on(eventTriggers, event => {
         if (o.searchOnEnterKey && event.keyCode !== 13) {
           return
         }
@@ -615,10 +625,17 @@ class BootstrapTable {
 
         clearTimeout(timeoutId) // doesn't matter if it's 0
         timeoutId = setTimeout(() => {
-          this.onSearch(event)
+          this.onSearch(o.showSearchButton ? {currentTarget: $searchInput} : event)
         }, o.searchTimeOut)
       })
 
+      if (o.showSearchClearButton) {
+        this.$toolbar.find('.search button[name=clearSearch]').click(() => {
+          this.resetSearch()
+          this.onSearch({currentTarget: this.$toolbar.find('.search input')})
+        })
+      }
+
       if (Utils.isIEBrowser()) {
         $search.off('mouseup').on('mouseup', event => {
           clearTimeout(timeoutId) // doesn't matter if it's 0
@@ -638,9 +655,6 @@ class BootstrapTable {
         $(currentTarget).val(text)
       }
 
-      if (text === this.searchText) {
-        return
-      }
       this.searchText = text
       this.options.searchText = text
     }

+ 22 - 7
src/constants/index.js

@@ -25,7 +25,9 @@ const CONSTANTS = {
       columns: 'glyphicon-th icon-th',
       detailOpen: 'glyphicon-plus icon-plus',
       detailClose: 'glyphicon-minus icon-minus',
-      fullscreen: 'glyphicon-fullscreen'
+      fullscreen: 'glyphicon-fullscreen',
+      search: 'glyphicon-search',
+      clearSearch: 'glyphicon-trash'
     },
     classes: {
       buttonsPrefix: 'btn',
@@ -33,7 +35,7 @@ const CONSTANTS = {
       buttonsGroup: 'btn-group',
       buttonsDropdown: 'btn-group',
       pull: 'pull',
-      inputGroup: '',
+      inputGroup: 'input-group',
       input: 'form-control',
       paginationDropdown: 'btn-group dropdown',
       dropup: 'dropup',
@@ -49,7 +51,10 @@ const CONSTANTS = {
       dropdownCaret: '<span class="caret"></span>',
       pagination: ['<ul class="pagination%s">', '</ul>'],
       paginationItem: '<li class="page-item%s"><a class="page-link" href="#">%s</a></li>',
-      icon: '<i class="%s %s"></i>'
+      icon: '<i class="%s %s"></i>',
+      inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
+      searchButton: '<button class="btn btn-default" type="button" name="search" title="%s"><i class="%s %s"></i></button>',
+      searchClearButton: '<button class="btn btn-default" type="button" name="clearSearch" title="%s"><i class="%s %s"></i></button>'
     }
   },
   4: {
@@ -61,9 +66,11 @@ const CONSTANTS = {
       toggleOff: 'fa-toggle-off',
       toggleOn: 'fa-toggle-on',
       columns: 'fa-th-list',
-      fullscreen: 'fa-arrows-alt',
       detailOpen: 'fa-plus',
-      detailClose: 'fa-minus'
+      detailClose: 'fa-minus',
+      fullscreen: 'fa-arrows-alt',
+      search: 'fa-search',
+      clearSearch: 'fa-trash'
     },
     classes: {
       buttonsPrefix: 'btn',
@@ -71,7 +78,7 @@ const CONSTANTS = {
       buttonsGroup: 'btn-group',
       buttonsDropdown: 'btn-group',
       pull: 'float',
-      inputGroup: '',
+      inputGroup: 'btn-group',
       input: 'form-control',
       paginationDropdown: 'btn-group dropdown',
       dropup: 'dropup',
@@ -87,7 +94,10 @@ const CONSTANTS = {
       dropdownCaret: '<span class="caret"></span>',
       pagination: ['<ul class="pagination%s">', '</ul>'],
       paginationItem: '<li class="page-item%s"><a class="page-link" href="#">%s</a></li>',
-      icon: '<i class="%s %s"></i>'
+      icon: '<i class="%s %s"></i>',
+      inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
+      searchButton: '<button class="btn btn-secondary" type="button" name="search" title="%s"><i class="%s %s"></i></button>',
+      searchClearButton: '<button class="btn btn-secondary" type="button" name="clearSearch" title="%s"><i class="%s %s"></i></button>'
     }
   }
 }[bootstrapVersion]
@@ -154,6 +164,8 @@ const DEFAULTS = {
   search: false,
   searchOnEnterKey: false,
   strictSearch: false,
+  showSearchButton: false,
+  showSearchClearButton: false,
   trimOnSearch: true,
   searchAlign: 'right',
   searchTimeOut: 500,
@@ -311,6 +323,9 @@ const EN = {
   formatSearch () {
     return 'Search'
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatNoMatches () {
     return 'No matching records found'
   },

+ 8 - 46
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -506,7 +506,6 @@ $.extend($.fn.bootstrapTable.defaults, {
   onCreatedControls () {
     return true
   },
-  filterShowClear: false,
   alignmentSelectControlOptions: undefined,
   filterTemplate: {
     input (that, field, isVisible, placeholder) {
@@ -562,12 +561,6 @@ $.extend($.fn.bootstrapTable.defaults.icons, {
   }[$.fn.bootstrapTable.theme] || 'fa-trash'
 })
 
-$.extend($.fn.bootstrapTable.locales, {
-  formatClearFilters () {
-    return 'Clear Filters'
-  }
-})
-
 $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales)
 
 $.fn.bootstrapTable.methods.push('triggerSearch')
@@ -622,44 +615,6 @@ $.BootstrapTable = class extends $.BootstrapTable {
     super.init()
   }
 
-  initToolbar () {
-    this.showToolbar =
-      this.showToolbar ||
-      (this.options.filterControl && this.options.filterShowClear)
-
-    super.initToolbar()
-
-    if (this.options.filterControl && this.options.filterShowClear) {
-      const $btnGroup = this.$toolbar.find('>.btn-group')
-      let $btnClear = $btnGroup.find('.filter-show-clear')
-
-      if (!$btnClear.length) {
-        $btnClear = $(
-          [
-            Utils.sprintf(
-              '<button class="btn btn-%s filter-show-clear" ',
-              this.options.buttonsClass
-            ),
-            Utils.sprintf(
-              'type="button" title="%s">',
-              this.options.formatClearFilters()
-            ),
-            Utils.sprintf(
-              '<i class="%s %s"></i> ',
-              this.options.iconsPrefix,
-              this.options.icons.clear
-            ),
-            '</button>'
-          ].join('')
-        ).appendTo($btnGroup)
-
-        $btnClear
-          .off('click')
-          .on('click', $.proxy(this.clearFilterControl, this))
-      }
-    }
-  }
-
   initHeader () {
     super.initHeader()
 
@@ -775,8 +730,15 @@ $.BootstrapTable = class extends $.BootstrapTable {
     this.trigger('column-search', $field, text)
   }
 
+  resetSearch () {
+    if (this.options.filterControl && this.options.showSearchClearButton) {
+      this.clearFilterControl()
+    }
+    super.resetSearch()
+  }
+
   clearFilterControl () {
-    if (this.options.filterControl && this.options.filterShowClear) {
+    if (this.options.filterControl) {
       const that = this
       const cookies = UtilsFilterControl.collectBootstrapCookies()
       const header = UtilsFilterControl.getCurrentHeader(that)

+ 3 - 3
src/locale/bootstrap-table-af-ZA.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['af-ZA'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Soek'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['af-ZA'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-ar-SA.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['ar-SA'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'بحث'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['ar-SA'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-ca-ES.js

@@ -21,6 +21,9 @@ $.fn.bootstrapTable.locales['ca-ES'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Cerca'
   },
@@ -51,9 +54,6 @@ $.fn.bootstrapTable.locales['ca-ES'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-cs-CZ.js

@@ -21,6 +21,9 @@ $.fn.bootstrapTable.locales['cs-CZ'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Vyhledávání'
   },
@@ -51,9 +54,6 @@ $.fn.bootstrapTable.locales['cs-CZ'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-da-DK.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['da-DK'] = {
   formatDetailPagination (totalRows) {
     return `Viser ${totalRows} række${(totalRows > 1) ? 'r' : ''}`
   },
+  formatClearSearch () {
+    return 'Ryd filtre'
+  },
   formatSearch () {
     return 'Søg'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['da-DK'] = {
   formatExport () {
     return 'Eksporter'
   },
-  formatClearFilters () {
-    return 'Ryd filtre'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-de-DE.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['de-DE'] = {
   formatDetailPagination (totalRows) {
     return `Zeige ${totalRows} Zeile${(totalRows > 1) ? 'n' : ''}.`
   },
+  formatClearSearch () {
+    return 'Lösche Filter'
+  },
   formatSearch () {
     return 'Suchen'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['de-DE'] = {
   formatExport () {
     return 'Datenexport'
   },
-  formatClearFilters () {
-    return 'Lösche Filter'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-el-GR.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['el-GR'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Αναζητήστε'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['el-GR'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-en-US.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['en-US'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Search'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['en-US'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-es-AR.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['es-AR'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Limpiar búsqueda'
+  },
   formatSearch () {
     return 'Buscar'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['es-AR'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-es-CL.js

@@ -21,6 +21,9 @@ $.fn.bootstrapTable.locales['es-CL'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Limpiar búsqueda'
+  },
   formatSearch () {
     return 'Buscar'
   },
@@ -51,9 +54,6 @@ $.fn.bootstrapTable.locales['es-CL'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-es-CR.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['es-CR'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Limpiar búsqueda'
+  },
   formatSearch () {
     return 'Buscar'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['es-CR'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-es-ES.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['es-ES'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Limpiar búsqueda'
+  },
   formatSearch () {
     return 'Buscar'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['es-ES'] = {
   formatExport () {
     return 'Exportar los datos'
   },
-  formatClearFilters () {
-    return 'Borrar los filtros'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-es-MX.js

@@ -22,6 +22,9 @@ $.fn.bootstrapTable.locales['es-MX'] = {
   formatDetailPagination (totalRows) {
     return `Mostrando ${totalRows} filas`
   },
+  formatClearSearch () {
+    return 'Limpiar búsqueda'
+  },
   formatSearch () {
     return 'Buscar'
   },
@@ -52,9 +55,6 @@ $.fn.bootstrapTable.locales['es-MX'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-es-NI.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['es-NI'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Limpiar búsqueda'
+  },
   formatSearch () {
     return 'Buscar'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['es-NI'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-es-SP.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['es-SP'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Limpiar búsqueda'
+  },
   formatSearch () {
     return 'Buscar'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['es-SP'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-et-EE.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['et-EE'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Otsi'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['et-EE'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-eu-EU.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['eu-EU'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Bilatu'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['eu-EU'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-fa-IR.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['fa-IR'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'جستجو'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['fa-IR'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-fi-FI.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['fi-FI'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Poista suodattimet'
+  },
   formatSearch () {
     return 'Hae'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['fi-FI'] = {
   formatExport () {
     return 'Vie tiedot'
   },
-  formatClearFilters () {
-    return 'Poista suodattimet'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-fr-BE.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['fr-BE'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Recherche'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['fr-BE'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-fr-FR.js

@@ -21,6 +21,9 @@ $.fn.bootstrapTable.locales['fr-FR'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Vider les filtres'
+  },
   formatSearch () {
     return 'Rechercher'
   },
@@ -51,9 +54,6 @@ $.fn.bootstrapTable.locales['fr-FR'] = {
   formatExport () {
     return 'Exporter les données'
   },
-  formatClearFilters () {
-    return 'Vider les filtres'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-he-IL.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['he-IL'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'חיפוש'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['he-IL'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-hr-HR.js

@@ -21,6 +21,9 @@ $.fn.bootstrapTable.locales['hr-HR'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Pretraži'
   },
@@ -51,9 +54,6 @@ $.fn.bootstrapTable.locales['hr-HR'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-hu-HU.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['hu-HU'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Keresés'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['hu-HU'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-id-ID.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['id-ID'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Bersihkan filter'
+  },
   formatSearch () {
     return 'Pencarian'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['id-ID'] = {
   formatExport () {
     return 'Ekspor data'
   },
-  formatClearFilters () {
-    return 'Bersihkan filter'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-it-IT.js

@@ -22,6 +22,9 @@ $.fn.bootstrapTable.locales['it-IT'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Pulisci filtri'
+  },
   formatSearch () {
     return 'Cerca'
   },
@@ -52,9 +55,6 @@ $.fn.bootstrapTable.locales['it-IT'] = {
   formatExport () {
     return 'Esporta dati'
   },
-  formatClearFilters () {
-    return 'Pulisci filtri'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-ja-JP.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['ja-JP'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return '検索'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['ja-JP'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-ka-GE.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['ka-GE'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'ძებნა'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['ka-GE'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-ko-KR.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['ko-KR'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return '검색'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['ko-KR'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-ms-MY.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['ms-MY'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Cari'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['ms-MY'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-nb-NO.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['nb-NO'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Søk'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['nb-NO'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-nl-NL.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['nl-NL'] = {
   formatDetailPagination (totalRows) {
     return `Toon ${totalRows} record${(totalRows > 1) ? 's' : ''}`
   },
+  formatClearSearch () {
+    return 'Verwijder filters'
+  },
   formatSearch () {
     return 'Zoeken'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['nl-NL'] = {
   formatExport () {
     return 'Exporteer data'
   },
-  formatClearFilters () {
-    return 'Verwijder filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-pl-PL.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['pl-PL'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Szukaj'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['pl-PL'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-pt-BR.js

@@ -21,6 +21,9 @@ $.fn.bootstrapTable.locales['pt-BR'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Pesquisar'
   },
@@ -51,9 +54,6 @@ $.fn.bootstrapTable.locales['pt-BR'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-pt-PT.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['pt-PT'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Pesquisa'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['pt-PT'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-ro-RO.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['ro-RO'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Cauta'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['ro-RO'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-ru-RU.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['ru-RU'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Очистить фильтры'
+  },
   formatSearch () {
     return 'Поиск'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['ru-RU'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Очистить фильтры'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-sk-SK.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['sk-SK'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Odstráň filtre'
+  },
   formatSearch () {
     return 'Vyhľadávanie'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['sk-SK'] = {
   formatExport () {
     return 'Exportuj dáta'
   },
-  formatClearFilters () {
-    return 'Odstráň filtre'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-sv-SE.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['sv-SE'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Sök'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['sv-SE'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-th-TH.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['th-TH'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'ค้นหา'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['th-TH'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-tr-TR.js

@@ -21,6 +21,9 @@ $.fn.bootstrapTable.locales['tr-TR'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Ara'
   },
@@ -51,9 +54,6 @@ $.fn.bootstrapTable.locales['tr-TR'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-uk-UA.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['uk-UA'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Очистити фільтри'
+  },
   formatSearch () {
     return 'Пошук'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['uk-UA'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Очистити фільтри'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-ur-PK.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['ur-PK'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'تلاش'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['ur-PK'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-uz-Latn-UZ.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['uz-Latn-UZ'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Filtrlarni tozalash'
+  },
   formatSearch () {
     return 'Qidirish'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['uz-Latn-UZ'] = {
   formatExport () {
     return 'Eksport'
   },
-  formatClearFilters () {
-    return 'Filtrlarni tozalash'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-vi-VN.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['vi-VN'] = {
   formatDetailPagination (totalRows) {
     return `Showing ${totalRows} rows`
   },
+  formatClearSearch () {
+    return 'Clear Search'
+  },
   formatSearch () {
     return 'Tìm kiếm'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['vi-VN'] = {
   formatExport () {
     return 'Export data'
   },
-  formatClearFilters () {
-    return 'Clear filters'
-  },
   formatJumpTo () {
     return 'GO'
   },

+ 3 - 3
src/locale/bootstrap-table-zh-CN.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['zh-CN'] = {
   formatDetailPagination (totalRows) {
     return `总共 ${totalRows} 条记录`
   },
+  formatClearSearch () {
+    return '清空过滤'
+  },
   formatSearch () {
     return '搜索'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['zh-CN'] = {
   formatExport () {
     return '导出数据'
   },
-  formatClearFilters () {
-    return '清空过滤'
-  },
   formatJumpTo () {
     return '跳转'
   },

+ 3 - 3
src/locale/bootstrap-table-zh-TW.js

@@ -20,6 +20,9 @@ $.fn.bootstrapTable.locales['zh-TW'] = {
   formatDetailPagination (totalRows) {
     return `總共 ${totalRows} 項記錄`
   },
+  formatClearSearch () {
+    return '清空過濾'
+  },
   formatSearch () {
     return '搜尋'
   },
@@ -50,9 +53,6 @@ $.fn.bootstrapTable.locales['zh-TW'] = {
   formatExport () {
     return '導出數據'
   },
-  formatClearFilters () {
-    return '清空過濾'
-  },
   formatJumpTo () {
     return '跳轉'
   },

+ 21 - 5
tools/check-locale.js

@@ -27,27 +27,43 @@ const baseText = fs.readFileSync(DIR + 'bootstrap-table-en-US.js').toString()
 const baseObj = readString(readObj(baseText), baseText)
 
 fs.readdir(`${DIR}`, (err, files) => {
+  let errorSum = 0
   for (const file of files) {
     if (!/\.js$/.test(file) || file === 'bootstrap-table-en-US.js') {
       continue
     }
 
-    console.log('-------------------------')
-    console.log(`Checking file: ${file}`)
-    console.log('-------------------------')
+
 
     const text = fs.readFileSync(DIR + file).toString()
     const obj = readString(readObj(text), text)
     const keys = Object.keys(obj)
     let offset = 0
+    const errors = []
 
     for (const [i, key] of Object.keys(baseObj).entries()) {
       if (!keys.includes(key)) {
-        console.log(chalk.red(`Missing key: '${key}'`))
+        errors.push(chalk.red(`Missing key: '${key}'`))
         offset++
       } else if (keys[i - offset] !== key) {
-        console.log(chalk.red(`Order error: '${key}'`))
+        errors.push(chalk.red(`Order error: '${key}'`))
       }
     }
+
+    errorSum += errors.length
+    if (errors.length > 0) {
+      console.log('-------------------------')
+      console.log(`Checking file: ${file}`)
+      console.log('-------------------------')
+
+      errors.forEach((error) => {
+        console.log(error)
+      })
+    }
   }
+
+  if (errorSum === 0) {
+    console.log('Good job! Anything up to date!')
+  }
+
 })