浏览代码

Fix bug delete an item append 2nd pass (#3043)

* Fix bug delete an item append 2nd pass 

See the jsfiddle => http://jsfiddle.net/ehen4v87/

* Update bootstrap-table.js
Flounn 8 年之前
父节点
当前提交
bf304e7537
共有 1 个文件被更改,包括 3 次插入10 次删除
  1. 3 10
      src/bootstrap-table.js

+ 3 - 10
src/bootstrap-table.js

@@ -943,21 +943,14 @@
      */
      */
     BootstrapTable.prototype.initData = function (data, type) {
     BootstrapTable.prototype.initData = function (data, type) {
         if (type === 'append') {
         if (type === 'append') {
-            this.data = this.data.concat(data);
-        } else if (type === 'prepend') {
-            this.data = [].concat(data).concat(this.data);
-        } else {
-            this.data = data || this.options.data;
-        }
-
-        // Fix #839 Records deleted when adding new row on filtered table
-        if (type === 'append') {
             this.options.data = this.options.data.concat(data);
             this.options.data = this.options.data.concat(data);
         } else if (type === 'prepend') {
         } else if (type === 'prepend') {
             this.options.data = [].concat(data).concat(this.options.data);
             this.options.data = [].concat(data).concat(this.options.data);
         } else {
         } else {
-            this.options.data = this.data;
+            this.options.data = data || this.options.data;
         }
         }
+        
+        this.data = this.options.data;
 
 
         if (this.options.sidePagination === 'server') {
         if (this.options.sidePagination === 'server') {
             return;
             return;