【发布时间】:2013-12-23 10:56:01
【问题描述】:
我有这段代码从 static url 获取 json 对象,然后呈现网格。但我想使用作为 AJAX 响应检索的 json 数据,然后使用此响应文本呈现网格。 因为实际部署我不能使用静态 URL。
$("#grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {url: "http://url/returnsjsonobject.php"}
//THIS GETS DATA FROM STATIC URL BUT I WANT TO READ DATA AS AJAX RESPONSE
//like read: somefunctioncall
//or like read: somevariable
},
schema: {
model: {
fields: {
id: {type: "string", editable: false},
name: {type: "string"}
}
}
},
pageSize: 20
},
height: 430
columns: [
{field: "id", title: "ID", width: "20px", hidden: "true"},
"name",
});
提前感谢您的帮助,如果您有任何替代方法;我很乐意尝试。
【问题讨论】:
标签: javascript jquery ajax kendo-ui kendo-grid