Using the example set out in the following page:
http://demos.kendoui.com/web/grid/hierarchy.html
I have tried to get this to use XML instead of oData. I get "a.replace is not a function" and "a is not defined" javascript errors.
I have managed to get the customers working but I do not know how to link the orders XML file. I think the problem is with the line: filter: { field: "customer", operator: "eq", value: "id/text()" } but I cannot find any examples of the Grid using XML, and do not know what to put for the "value" to get this to match up to the value of the "id" node in the customers XML file - can anyone help?
http://demos.kendoui.com/web/grid/hierarchy.html
I have tried to get this to use XML instead of oData. I get "a.replace is not a function" and "a is not defined" javascript errors.
I have managed to get the customers working but I do not know how to link the orders XML file. I think the problem is with the line: filter: { field: "customer", operator: "eq", value: "id/text()" } but I cannot find any examples of the Grid using XML, and do not know what to put for the "value" to get this to match up to the value of the "id" node in the customers XML file - can anyone help?
$(document).ready(function() {
var element = $("#grid").kendoGrid({
dataSource: new kendo.data.DataSource({
type: "xml", // specifies data protocol
pageSize: 6, // limits result set
serverPaging: true,
serverSorting: true,
transport: {
read: "customers.xml"
},
schema: {
type: "xml",
data: "/Customers/Customer",
model: {
fields: {
id: "id/text()",
surname: "surname/text()",
forename: "forename/text()",
email: "email/text()"
}
}
}
}),
height: 450,
sortable: true,
pageable: true,
detailInit: detailInit,
dataBound: function() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
},
columns: [{
field:"id",
filterable: false
},
"surname",
"forename",
"email"
]
});
});
function detailInit(e) {
$("<
div
/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
type: "xml",
transport: {
read: "orders.xml"
},
schema: {
type: "xml",
data: "/orders/order",
model: {
fields: {
id: "id/text()",
net: "net/text()",
vat: "vat/text()",
dispatched: "dispatched/text()"
}
}
},
serverPaging: true,
serverSorting: true,
serverFiltering: true,
pageSize:6,
filter: { field: "customer", operator: "eq", value: "id/text()" }
},
scrollable: false,
sortable: true,
pageable: true,
columns: [ "id", "net", "vat", "dispatched" ]
});
}