我正在尝试在viewModel中配置一个kendo.data.DataSource,以通过函数返回一个简单的json对象。我尝试了以下但它不起作用。
departmentDropDownDataSource: new kendo.data.DataSource( {
read: function () {
return {
data: [
{ Department: "Electronics" },
{ Department: "Facilities" },
{ Department: "Project Support" },
{ Department: "Services" } ]
};
}
})
答案 0 :(得分:1)
read
接受一个参数,称之为op
,然后以数据作为参数调用op.success
。
read : function (op) {
op.success([
{ Department: "Electronics" },
{ Department: "Facilities" },
{ Department: "Project Support" },
{ Department: "Services" } ] );
}