Table 分页不正确且不限制记录 - Bootstrap 数据表
Table Pagination Incorrect and Not limiting records - Bootstrap Datatable
我有一个 bootstrap table 从另一个站点拉取 json 但由于某种原因分页不正确:
http://fragrate.net/index.php?queryp=&task=searchplayers
如果看到底部 table:
数据加载正确
单击记录限制下拉列表不会限制记录
点击第 2 页刷新 table 但数据没有改变
这是我从以下位置获得 table 的地方:
http://wenzhixin.net.cn/p/bootstrap-table/docs/examples.html#pagination-table
CAUSE
您已为 table
元素启用 server-side pagination 和 data-side-pagination="server"
属性。
SOLUTION #1
通过删除 data-side-pagination="server"
属性禁用服务器端分页。
- 删除
data-side-pagination="server"
属性
更改响应格式,使其仅包含对象数组。根据 documentation:
Note that the required server response format is different depending on whether the sidePagination
option is specified. See the following examples:
有关代码和演示,请参阅 this jsFiddle。
SOLUTION #2
在服务器上实现分页。在其他参数中,浏览器发送包含请求记录数的 limit
参数和包含起始记录的 offset
参数。
我有一个 bootstrap table 从另一个站点拉取 json 但由于某种原因分页不正确:
http://fragrate.net/index.php?queryp=&task=searchplayers
如果看到底部 table: 数据加载正确 单击记录限制下拉列表不会限制记录 点击第 2 页刷新 table 但数据没有改变
这是我从以下位置获得 table 的地方:
http://wenzhixin.net.cn/p/bootstrap-table/docs/examples.html#pagination-table
CAUSE
您已为 table
元素启用 server-side pagination 和 data-side-pagination="server"
属性。
SOLUTION #1
通过删除 data-side-pagination="server"
属性禁用服务器端分页。
- 删除
data-side-pagination="server"
属性 更改响应格式,使其仅包含对象数组。根据 documentation:
Note that the required server response format is different depending on whether the
sidePagination
option is specified. See the following examples:
有关代码和演示,请参阅 this jsFiddle。
SOLUTION #2
在服务器上实现分页。在其他参数中,浏览器发送包含请求记录数的 limit
参数和包含起始记录的 offset
参数。