【发布时间】:2014-03-06 23:02:56
【问题描述】:
我正在使用带有服务器分页的 KendoUI 网格,我也在服务器端使用 symfony2,我已经创建了处理请求的路由:
_callsList:
pattern: /callsList/{id_client}/{take}/{skip}/{page}/{pageSize}
defaults: { _controller: StoreBundle:Voip:callsList, take: 20, skip: 0, page: 1, pageSize: 20 }
这是我对网格的定义:
$("#grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: "{{url('_callsList', {'id_client': 3, 'take': 20, 'skip': 0, 'page': 1, 'pageSize': 20})}}"
},
schema: {
model: {
fields: {
callerId: { type: "string" },
calledNumber: { type: "string" },
callStart: { type: "string" },
duration: { type: "string" }
}
}
},
pageSize: 20,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
schema: {
total : "total",
data: "result"
}
},
height: 430,
scrollable: true,
sortable: true,
pageable: {
input: true,
numeric: false
},
columns: [
{ field: "callerId", title: "Numero de Salida", width: "130px" },
{ field: "calledNumber", title: "Numero de Destino", width: "180px" },
{ field: "callStart", title: "Fecha", width: "100px" },
{ field: "duration", title: "Duracion (segundos)", width: "80px" }
]
});
网格加载正常,但是当我点击第二页时,发送到服务器的 URL 是这样的:
http://mydomain.com/app_dev.php/callsList/3/20/0/1/20?take=20&skip=20&page=2&pageSize=20
Grid 无法获取第二页,一直拉取前 20 个结果。正确的 URL 应该是这样的:
http://mydomain.com/app_dev.php/callsList/3/20/20/2/20
正如我在路由文件上设置的那样。
知道如何解决这个问题吗???
谢谢!
【问题讨论】:
标签: php symfony kendo-grid