我有一个Kendo
Grid,我想将一个参数传递给我的Controller Action
. 我能够成功使用传输 read.data 但我正在尝试学习如何使用 parameterMap 功能。
这是我的工作:
<script>
$(document).ready(function () {
var employeeNumber = @(ViewBag.EmployeeNumber); //passed in from controller
$("#ShoppingCartGrid").kendoGrid({
dataSource: {
dataType: "json",
type:"GET",
transport: {
read: {
url:"../Requisitions/GetShoppingCartSummary/",
data: {
employeeNumber:employeeNumber //passing param this way works
},
}
},
schema: {
...... //omitted for brevity
</script>
这是什么不起作用,但我不知道我应该在这里放什么:
<script>
$(document).ready(function () {
var employeeNumber = @(ViewBag.EmployeeNumber);
$("#ShoppingCartGrid").kendoGrid({
dataSource: {
dataType: "json",
type:"GET",
transport: {
read: {
url:"../Requisitions/GetShoppingCartSummary/"
},
parameterMap:function(options,operation){ // here is where I'm
if (operation == "read") { // running into issues- even
return employeeNumber:"140412"; // hard coding param- no joy
}
};
},
schema: {
...... //omitted for brevity
</script>
我已经找了几个小时来寻找解决方案,但我似乎找不到一篇足以很好地解释这个概念的帖子让我理解。请不要发送指向 Kendo 文档的链接,去过那里,有精神伤疤来证明这一点。感谢您的任何建议。