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 as the datasource instead of oData. I get an "d is not defined" javascript error.
I think it must be the filter that is not working.
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? The whole code is below.
http://demos.kendoui.com/web/grid/hierarchy.html
I have tried to get this to use XML as the datasource instead of oData. I get an "d is not defined" javascript error.
I think it must be the filter that is not working.
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? The whole code is below.
$(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" ]
});
}