浏览代码

Fix #171: IE disabled button can be clicked bug.

zhixin 11 年之前
父节点
当前提交
9730deacff
共有 2 个文件被更改,包括 18 次插入12 次删除
  1. 1 0
      README.md
  2. 17 12
      src/bootstrap-table.js

+ 1 - 0
README.md

@@ -28,6 +28,7 @@ Bootstrap table displays data in a tabular format and offers rich support to rad
 - [x] Add cs-CZ and es-CR locales.
 - [x] Fix minimumCountColumns option init error.
 - [x] Fix #161: undefined or null string sort bug.
+- [x] Fix #171: IE disabled button can be clicked bug.
 
 ## Features
 

+ 17 - 12
src/bootstrap-table.js

@@ -730,7 +730,7 @@
             }
         }
         for (i = from; i <= to; i++) {
-            html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active' : '') + '">',
+            html.push('<li class="page-number' + (i === this.options.pageNumber ? ' active disabled' : '') + '">',
                 '<a href="javascript:void(0)">', i ,'</a>',
                 '</li>');
         }
@@ -766,7 +766,12 @@
         $number.off('click').on('click', $.proxy(this.onPageNumber, this));
     };
 
-    BootstrapTable.prototype.updatePagination = function () {
+    BootstrapTable.prototype.updatePagination = function (event) {
+        // Fix #171: IE disabled button can be clicked bug.
+        if (event && $(event.currentTarget).hasClass('disabled')) {
+            return;
+        }
+
         if (!this.options.maintainSelected) {
             this.resetRows();
         }
@@ -785,27 +790,27 @@
         $this.parent().addClass('active').siblings().removeClass('active');
         this.options.pageSize = +$this.text();
         this.$toolbar.find('.page-size').text(this.options.pageSize);
-        this.updatePagination();
+        this.updatePagination(event);
     };
 
-    BootstrapTable.prototype.onPageFirst = function () {
+    BootstrapTable.prototype.onPageFirst = function (event) {
         this.options.pageNumber = 1;
-        this.updatePagination();
+        this.updatePagination(event);
     };
 
-    BootstrapTable.prototype.onPagePre = function () {
+    BootstrapTable.prototype.onPagePre = function (event) {
         this.options.pageNumber--;
-        this.updatePagination();
+        this.updatePagination(event);
     };
 
-    BootstrapTable.prototype.onPageNext = function () {
+    BootstrapTable.prototype.onPageNext = function (event) {
         this.options.pageNumber++;
-        this.updatePagination();
+        this.updatePagination(event);
     };
 
-    BootstrapTable.prototype.onPageLast = function () {
+    BootstrapTable.prototype.onPageLast = function (event) {
         this.options.pageNumber = this.totalPages;
-        this.updatePagination();
+        this.updatePagination(event);
     };
 
     BootstrapTable.prototype.onPageNumber = function (event) {
@@ -813,7 +818,7 @@
             return;
         }
         this.options.pageNumber = +$(event.currentTarget).text();
-        this.updatePagination();
+        this.updatePagination(event);
     };
 
     BootstrapTable.prototype.initBody = function (fixedScroll) {