Kendo ui 剑道UI网格、restful URL和分页
我有一个web服务,通过它我可以从jquery中获取文本,并使用Kendo ui 剑道UI网格、restful URL和分页,kendo-ui,Kendo Ui,我有一个web服务,通过它我可以从jquery中获取文本,并使用$parseJSON将其解析为JSON 客户端可以通过加载http://myserver/myfunction/{pagenumber}/{pagesize} 这将返回一个对象 { total: <some int> //A number indicating the total number of records rowsForPage: [......] //An array with just the rows f
$parseJSON
将其解析为JSON
客户端可以通过加载http://myserver/myfunction/{pagenumber}/{pagesize}
这将返回一个对象
{
total: <some int> //A number indicating the total number of records
rowsForPage: [......] //An array with just the rows for the requested page
}
{
total://表示记录总数的数字
rowsForPage:[…]//仅包含请求页面的行的数组
}
如何将此端点用作剑道UI网格的数据源,剑道UI网格将传递所选页面的页码和页面大小
就我的一生而言,我无法理解这一点,但我认为这应该是相对简单的
$("#grid").kendoGrid({
dataSource: {
serverPaging: true,
schema: {
data: function(data) {
return data.rowsForPage;
},
total: function(data) {
return data.total;
}
},
transport: {
read: "http://myserver/myfunction"
}
}
);
就url而言,您必须解析出url参数skip和take,以确定应该传回哪些记录。如果页面大小为100,页面大小为3,则应通过
skip=200&take=100
我认为问题更多的是如何设置url读取路径
myserver/myfunction/100/200
,而不在调用服务器之前覆盖读取值。我知道如何通过设置datasource的parameterMap属性来为非rest调用执行此操作,但是如果需要修改url,如何告诉datasource将参数附加为url呢。