【发布时间】:2015-08-17 22:32:06
【问题描述】:
我正在尝试使用 Kendo 的 Dynamic Linq Helper 库。网格上的参数映射函数没有正确的参数发送到控制器。
parameterMap 选项有: {"take":10,"skip":0,"page":1,"pageSize":10}
但是按照例子,应该有take、skip、sort、filter,这些不在parameterMap函数中,也没有传给服务器。
我这里是按照例子来的
http://www.telerik.com/blogs/kendo-ui-open-sources-dynamic-linq-helpers
还看了其他例子,我的网格设置和其他的一样。
唯一的区别是,这是一个 Web API 单页应用程序,而不是 MVC。但是,这不会对 Grid 类传递给它的 parameterMap 函数的内容产生影响。
这是怎么回事?
$("#grid").kendoGrid({
dataSource: {
transport: {
read: {
url: "http://localhost/biahost/query/projectStatuses",
dataType: "application/json",
type: "POST",
contentType: "application/json; charset=utf-8"
//data:{}
},
parameterMap: function (options) {
debugger;
//options only contain {"take":10,"skip":0,"page":1,"pageSize":10}
return kendo.stringify(options);
}
},
schema: {
data: "Data",
total: "Total",
model: {
fields: {
NAME: { type: "string" },
CODE: { type: "string" },
STATUS: { type: "string" },
COMMENTS: { type: "string" },
INSERTS: { type: "string" },
UPDATES: { type: "string" },
TOTAL_UPDATES: { type: "string" },
LAST_ACTION_DATE: { type: "string" }
//UnitId: { type: "string" },
//UnitName: { type: "string" }
}
}
},
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
filterable: true,
sortable: true,
pageable: true,
columns: projectStatusColumns
});
var projectStatusColumns = [
{
field: 'NAME',
label: 'Res name',
hidden: true,
},
{
field: 'CODE',
label: 'Code'
},
{
field: 'STATUS',
label: 'Status'
},
{
field: 'COMMENTS',
label: 'Comments'
}
,
{
field: 'INSERTS',
label: 'Inserts'
}
,
{
field: 'UPDATES',
label: 'Updates'
}
,
{
field: 'TOTAL_UPDATES',
label: 'Total Updates'
}
,
{
field: 'LAST_ACTION_DATE',
label: 'Last Action Date'
}
];
【问题讨论】:
标签: kendo-ui kendo-grid asp.net-web-api