浏览代码

#6532 - separate on/off icon+text for custom view toolbar icon

Marcel Overdijk 3 年之前
父节点
当前提交
471ccd956e
共有 2 个文件被更改,包括 2 次插入11 次删除
  1. 0 6
      site/docs/extensions/custom-view.md
  2. 2 5
      src/extensions/custom-view/bootstrap-table-custom-view.js

+ 0 - 6
site/docs/extensions/custom-view.md

@@ -107,12 +107,6 @@ This extension adds the ability to create a custom view to display the data.
 
 
 ## Localizations
 ## Localizations
 
 
-### formatToggleCustomView
-
-- **type:** `Function`
-
-- **Default:** `function () { return "Hide/Show custom view" }`
-
 ### formatToggleCustomViewOn
 ### formatToggleCustomViewOn
 
 
 - **type:** `Function`
 - **type:** `Function`

+ 2 - 5
src/extensions/custom-view/bootstrap-table-custom-view.js

@@ -45,9 +45,6 @@ $.extend($.fn.bootstrapTable.defaults, {
 })
 })
 
 
 $.extend($.fn.bootstrapTable.locales, {
 $.extend($.fn.bootstrapTable.locales, {
-  formatToggleCustomView () {
-    return 'Hide/Show custom view'
-  },
   formatToggleCustomViewOn () {
   formatToggleCustomViewOn () {
     return 'Show custom view'
     return 'Show custom view'
   },
   },
@@ -81,8 +78,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
           icon: this.options.customViewDefaultView ? this.options.icons.customViewOn : this.options.icons.customViewOff,
           icon: this.options.customViewDefaultView ? this.options.icons.customViewOn : this.options.icons.customViewOff,
           event: this.toggleCustomView,
           event: this.toggleCustomView,
           attributes: {
           attributes: {
-            'aria-label': this.options.formatToggleCustomView(),
-            title: this.options.formatToggleCustomView()
+            'aria-label': this.options.customViewDefaultView ? this.options.formatToggleCustomViewOff() : this.options.formatToggleCustomViewOn(),
+            title: this.options.customViewDefaultView ? this.options.formatToggleCustomViewOff() : this.options.formatToggleCustomViewOn()
           }
           }
         }
         }
       })
       })