0
我正在嘗試將XML數據源綁定到KendoGrid。但網格不顯示任何數據。kendo UI如何將xml數據源綁定到KendoGrid
下面是代碼
var dataSource = new kendo.data.DataSource({
data: '<books><book id="1"><title>Secrets of the JavaScript Ninja</title></book></books>',
schema: {
// specify the the schema is XML
type: "xml",
// the XML element which represents a single data record
data: "/books/book",
// define the model - the object which will represent a single data record
model: {
// configure the fields of the object
fields: {
// the "title" field is mapped to the text of the "title" XML element
title: "title/text()"
}
},
schema: {
model: {
fields: {
Title: { editable: false, nullable: true }
}
}
}
}
});
// alert(errorDataSource.read());
var pc = $("#gridError").kendoGrid({
//excel: { fileName: "Client Orders.xlsx", filterable: true },
dataSource: dataSource,
scrollable: true,
pageable: true,
navigatable: true,
columns: [
{ command: "destroy", width: 100 },
{
title: "Error Message",
//lock: true,
columns: [
{ field: "Title", title: "Error", width: 600, headerAttributes: { class: "k-header-wrap" } }
],
}
]
});
能否請你幫忙。
理想情況下,我想現在顯示基於e.XMLHttpRequest.responseText的錯誤消息;
有沒有簡單的方法將其綁定到Kendo-Grid?
謝謝。
謝謝Jayesh。它正在工作。非常感謝。 –