[英]Simple Kendo UI remote DataSource returns empty
Here is a simple example I'm trying to build as an exercise and my DataSource object returns with no data. 这是一个简单的例子,我正在尝试构建一个练习,我的DataSource对象返回时没有数据。
var data = new kendo.data.DataSource({
transport: {
read: {
url: "data.json",
dataType: "json"
}
}
});
console.dir( data );
data.json data.json
[
{
"text": "Brand One"
},
{
"text": "Brand Two"
},
{
"text": "Brand Three"
},
{
"text": "Brand Four"
}
]
Any ideas? 有任何想法吗?
There are two issues with your code 您的代码有两个问题
I can load load array to datasource and returns object, see 我可以将load数组加载到datasource并返回对象,参见
var data_input= [
{
"text": "Brand One"
},
{
"text": "Brand Two"
},
{
"text": "Brand Three"
},
{
"text": "Brand Four"
}
];
var data = new kendo.data.DataSource({
transport: {
read: {
data: data_input,
dataType: "json"
}
}
});
console.log(data)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.