浏览代码

Fix/5356 (#5357)

* fix issue with the "all" option if smartDisplay is active

* improved the documentation

Co-authored-by: Dennis Hernández <dennishernandezvargas@gmail.com>
Dustin Utecht 5 年之前
父节点
当前提交
24623e712d
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 2 0
      site/docs/api/table-options.md
  2. 1 1
      src/bootstrap-table.js

+ 2 - 0
site/docs/api/table-options.md

@@ -846,6 +846,8 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
   When set pagination property, initialize the page size selecting list. If you include the `'all'` or `'unlimited'` option, all the records will be shown in your table.
 
+  *Hint: If the table has lesser rows as the option(s), the options will be hidden automatically, to disable that feature you can set [smartDisplay](https://bootstrap-table.com/docs/api/table-options/#smartdisplay) to `false`*
+
 - **Default:** `[10, 25, 50, 100]`
 
 - **Example:** [Page List](https://examples.bootstrap-table.com/#options/page-list.html)

+ 1 - 1
src/bootstrap-table.js

@@ -1181,7 +1181,7 @@ class BootstrapTable {
       ]
 
       pageList.forEach((page, i) => {
-        if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows) {
+        if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows || page === opts.formatAllRows()) {
           let active
 
           if (allSelected) {