Browse Source

Check if the buttons option returned an array of buttons

Dustin Utecht 5 years ago
parent
commit
1fc9eba98a
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/bootstrap-table.js

+ 4 - 1
src/bootstrap-table.js

@@ -46,7 +46,10 @@ class BootstrapTable {
       Utils.sprintf(`${buttonsPrefix}%s`, opts.iconSize)
       Utils.sprintf(`${buttonsPrefix}%s`, opts.iconSize)
     ].join(' ').trim()
     ].join(' ').trim()
 
 
-    this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], [])
+    this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], {})
+    if (typeof this.buttons !== 'object') {
+      this.buttons = {}
+    }
   }
   }
 
 
   initLocale () {
   initLocale () {