ソースを参照

Fixed the custom view attributes (collided with the new button handling (#6287)

system)
Dustin Utecht 3 年 前
コミット
5e2d8b26f3

+ 4 - 4
site/docs/extensions/custom-view.md

@@ -34,9 +34,9 @@ This extension adds the ability to create a custom view to display the data.
 
 
 - **Default:** `false`
 - **Default:** `false`
 
 
-### showCustomView
+### customViewDefaultView
 
 
-- **Attribute:** `data-show-custom-view`
+- **Attribute:** `data-custom-view-default-view`
 
 
 - **Type:** `Boolean`
 - **Type:** `Boolean`
 
 
@@ -46,9 +46,9 @@ This extension adds the ability to create a custom view to display the data.
 
 
 - **Default:** `false`
 - **Default:** `false`
 
 
-### showCustomViewButton
+### showCustomView
 
 
-- **Attribute:** `data-show-custom-view-button`
+- **Attribute:** `data-show-custom-view`
 
 
 - **Type:** `Boolean`
 - **Type:** `Boolean`
 
 

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

@@ -7,8 +7,7 @@ const Utils = $.fn.bootstrapTable.utils
 
 
 $.extend($.fn.bootstrapTable.defaults, {
 $.extend($.fn.bootstrapTable.defaults, {
   customView: false,
   customView: false,
-  showCustomView: false,
-  showCustomViewButton: false
+  customViewDefaultView: false
 })
 })
 
 
 $.extend($.fn.bootstrapTable.defaults.icons, {
 $.extend($.fn.bootstrapTable.defaults.icons, {
@@ -49,13 +48,13 @@ $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
 $.BootstrapTable = class extends $.BootstrapTable {
 $.BootstrapTable = class extends $.BootstrapTable {
 
 
   init () {
   init () {
-    this.showCustomView = this.options.showCustomView
+    this.customViewDefaultView = this.options.customViewDefaultView
 
 
     super.init()
     super.init()
   }
   }
 
 
   initToolbar (...args) {
   initToolbar (...args) {
-    if (this.options.customView && this.options.showCustomViewButton) {
+    if (this.options.customView) {
       this.buttons = Object.assign(this.buttons, {
       this.buttons = Object.assign(this.buttons, {
         customView: {
         customView: {
           text: this.options.formatToggleCustomView(),
           text: this.options.formatToggleCustomView(),
@@ -84,7 +83,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
 
     $table.hide()
     $table.hide()
     $customViewContainer.hide()
     $customViewContainer.hide()
-    if (!this.options.customView || !this.showCustomView) {
+    if (!this.options.customView || !this.customViewDefaultView) {
       $table.show()
       $table.show()
       return
       return
     }
     }
@@ -103,7 +102,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
   }
   }
 
 
   toggleCustomView () {
   toggleCustomView () {
-    this.showCustomView = !this.showCustomView
+    this.customViewDefaultView = !this.customViewDefaultView
     this.initBody()
     this.initBody()
   }
   }
 }
 }