Browse Source

Fixed insertRow not write to source data array bug with empty data initialized (#4906)

文翼 5 years ago
parent
commit
9009c36070
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/bootstrap-table.js

+ 3 - 2
src/bootstrap-table.js

@@ -184,8 +184,9 @@ class BootstrapTable {
 
 
     // if options.data is setting, do not process tbody and tfoot data
     // if options.data is setting, do not process tbody and tfoot data
     if (!this.options.data.length) {
     if (!this.options.data.length) {
-      this.options.data = Utils.trToData(this.columns, this.$el.find('>tbody>tr'))
-      if (this.options.data.length) {
+      const htmlData = Utils.trToData(this.columns, this.$el.find('>tbody>tr'))
+      if (htmlData.length) {
+        this.options.data = htmlData
         this.fromHtml = true
         this.fromHtml = true
       }
       }
     }
     }