Browse Source

Merge pull request #4950 from wenzhixin/fix/4936

Fixed the page-change event before init server
Dustin Utecht 5 years ago
parent
commit
90107ccdc0
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/bootstrap-table.js

+ 4 - 3
src/bootstrap-table.js

@@ -1176,13 +1176,14 @@ class BootstrapTable {
     }
     }
 
 
     this.initPagination()
     this.initPagination()
+
+    this.trigger('page-change', this.options.pageNumber, this.options.pageSize)
+
     if (this.options.sidePagination === 'server') {
     if (this.options.sidePagination === 'server') {
       this.initServer()
       this.initServer()
     } else {
     } else {
       this.initBody()
       this.initBody()
     }
     }
-
-    this.trigger('page-change', this.options.pageNumber, this.options.pageSize)
   }
   }
 
 
   onPageListChange (event) {
   onPageListChange (event) {
@@ -1469,7 +1470,7 @@ class BootstrapTable {
     // show no records
     // show no records
     if (!hasTr) {
     if (!hasTr) {
       this.$body.html(`<tr class="no-records-found">${Utils.sprintf('<td colspan="%s">%s</td>',
       this.$body.html(`<tr class="no-records-found">${Utils.sprintf('<td colspan="%s">%s</td>',
-        this.$header.find('th').length,
+        this.getVisibleFields().length,
         this.options.formatNoMatches())}</tr>`)
         this.options.formatNoMatches())}</tr>`)
     } else {
     } else {
       if (!this.options.virtualScroll) {
       if (!this.options.virtualScroll) {