[英]Bootstrap Table: server side pagination parameters don't reach server
I've setup a Boostrap table like this: 我已经建立了一个Boostrap表,如下所示:
$('#usertable').bootstrapTable({
columns: [{
field: 'id',
title: 'User ID'
}, {
field: 'username',
title: 'Username'
}, {
field: 'email',
title: 'Email'
}],
sidePagination: 'server',
url: 'http://devapi.vreserver.com/api/users/',
pagination: true
});
The test api server works fine (as I can see by a curl request). 测试api服务器工作正常(如我在curl请求中所见)。 Adding the additional GET parameters in the URL (?order=desc&offset=0&limit=10) the api returns just 10 rows (starting from the latest id):
在api中添加其他GET参数(?order = desc&offset = 0&limit = 10)时,api仅返回10行(从最新ID开始):
But the result bootstrap table has always all user rows - and also changing page doesn't affect the result. 但是结果引导表始终包含所有用户行-而且更改页面也不会影响结果。
Having control on the server I saw that the GET parameters passed by requests, that are triggered by bootstrap table - simply doesn't exist on server side. 在服务器上进行控制后,我看到由引导表触发的请求传递的GET参数-在服务器端根本不存在。 But any other request (like from other js scripts on the same app), with the same url request (?order=desc&offset=0&limit=10) acts well.
但是任何其他具有相同url请求(?order = desc&offset = 0&limit = 10)的请求(例如来自同一应用程序上其他js脚本的请求)都可以正常工作。
Any clue where should I look for a fix to this? 有什么线索我应该在哪里寻找解决办法?
Thank you. 谢谢。
Problem still here, but found a workaround... 问题仍然存在,但是找到了解决方法...
Added on server side a route to accept also POST to retrieve users data, then added: 在服务器端添加了一条路由,以接受POST来检索用户数据,然后添加:
method: 'post',
url: 'new-url-for-post'
in table options. 在表格选项中。
Now it works, but I still cannot understand why GET is not working. 现在可以使用了,但是我仍然不明白为什么GET无法使用。 :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.