ソースを参照

Add data-page-list attribute.

zhixin 11 年 前
コミット
1cfe94378b
3 ファイル変更9 行追加3 行削除
  1. 1 1
      docs/docs.js
  2. 1 0
      docs/examples.html
  3. 7 2
      src/bootstrap-table.js

+ 1 - 1
docs/docs.js

@@ -148,7 +148,7 @@ $(function () {
                 },
                 {
                     name: 'pageList',
-                    attribute: '-',
+                    attribute: 'data-page-list',
                     type: 'Array',
                     description: 'When set pagination property, initialize the page size selecting list.',
                     'default': '[10, 25, 50, 100]'

+ 1 - 0
docs/examples.html

@@ -480,6 +480,7 @@
                            data-height="400"
                            data-side-pagination="server"
                            data-pagination="true"
+                           data-page-list="[5, 10, 20, 50, 100, 200]"
                            data-search="true"
                            data-query-params="queryParams">
                         <thead>

+ 7 - 2
src/bootstrap-table.js

@@ -480,9 +480,14 @@
             '</span>',
             ' <span class="caret"></span>',
             '</button>',
-            '<ul class="dropdown-menu" role="menu">'];
+            '<ul class="dropdown-menu" role="menu">'],
+            pageList = this.options.pageList;
 
-        $.each(this.options.pageList, function (i, page) {
+        if (typeof this.options.pageList === 'string') {
+            pageList = eval(this.options.pageList);
+        }
+
+        $.each(pageList, function (i, page) {
             var active = page === that.options.pageSize ? ' class="active"' : '';
             pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page));
         });