浏览代码

Fixed events cannot work on virtual scroll

zhixin 6 年之前
父节点
当前提交
3c7f222dc6
共有 1 个文件被更改,包括 14 次插入10 次删除
  1. 14 10
      src/bootstrap-table.js

+ 14 - 10
src/bootstrap-table.js

@@ -1441,6 +1441,7 @@ class BootstrapTable {
           itemHeight: this.options.virtualScrollItemHeight,
           callback: () => {
             this.fitHeader()
+            this.initBodyEvent()
           }
         })
       }
@@ -1450,6 +1451,19 @@ class BootstrapTable {
       this.scrollTo(0)
     }
 
+    this.initBodyEvent()
+    this.updateSelected()
+    this.initFooter()
+    this.resetView()
+
+    if (this.options.sidePagination !== 'server') {
+      this.options.totalRows = data.length
+    }
+
+    this.trigger('post-body', data)
+  }
+
+  initBodyEvent () {
     // click to select by column
     this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', e => {
       const $td = $(e.currentTarget)
@@ -1550,16 +1564,6 @@ class BootstrapTable {
         })
       }
     })
-
-    this.updateSelected()
-    this.initFooter()
-    this.resetView()
-
-    if (this.options.sidePagination !== 'server') {
-      this.options.totalRows = data.length
-    }
-
-    this.trigger('post-body', data)
   }
 
   initServer (silent, query, url) {