我正在尝试调用read方法,但也要传递参数。下面是我的代码,可以看到正在传递值,但控制台中存在错误:
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: URL + "/Read?StudentNum=" + studentNum + "AndStudentDept=" + studentDept,
dataType: "json",
data: {
studentNum: studentNum,
studentDept: studentDept
}
},
pageSize: 5,
schema: {
data: function (response) {
console.log(response);
return response.Data.dsstudentReport.ttstudentReport;
},
}
}
});
The error is: kendo.all.js:7165 Uncaught TypeError: e.slice is not a function
I will continue to keep looking but if anyone could help me identify where I have made a mistake, that would be greatly appreciated. I am new to Kendo and still learning.
Thanks
经常发生此错误,因为model
中没有schema
。尝试添加它。例如:
transport: {},
schema: {
model: {
id: "id",
fields: {
name: { type: "string" },
isActive: { type: "boolean" },
age: { type: "number" }
}
}
}
它表示您正在使用read
方法获取的数据结构。
Ps。 schema
必须与transport
处于同一级别。您的情况schema
位于transport
内部