Hi all,
I am trying to get an XML datasource working, but unfortunately without success.
The XML-data I provided locally in a variable. The whole code is below.
If I load the page firebug comes up with an error message:
b.slice is not a function.
Can anyone assist please?
Thanks for any help!
I am trying to get an XML datasource working, but unfortunately without success.
The XML-data I provided locally in a variable. The whole code is below.
If I load the page firebug comes up with an error message:
b.slice is not a function.
Can anyone assist please?
Thanks for any help!
<
html
>
<
head
>
<
link
href
=
"/css/kendo/styles/kendo.common.min.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"/css/kendo/styles/kendo.default.min.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<!--link href="/css/kendo/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" /-->
<
script
src
=
"/js/kendo/js/jquery.min.js"
type
=
"text/javascript"
></
script
>
<
script
src
=
"/js/kendo/js/kendo.web.min.js"
type
=
"text/javascript"
></
script
>
</
head
>
<
body
>
<
div
id
=
"grid"
>
</
div
>
</
body
>
<
script
type
=
"text/javascript"
>
$(
function()
{
var dsXMLData = "<
items
><
Item
><
No
>4711</
No
><
Description
>Artikel 4711</
Description
><
UnitPrice
>12.34</
UnitPrice
></
Item
><
Item
><
No
>4712</
No
><
Description
>Artikel 4712</
Description
><
UnitPrice
>24.68</
UnitPrice
></
Item
></
items
>";
var dsXML = new kendo.data.DataSource (
{
data: dsXMLData,
schema:
{
type: 'xml',
data: '/items/Item',
model:
{
fields:
{
itemno: { field: "No/text()" },
description: { field: "Description/text()" },
unitprice: { field: "UnitPrice/text()" }
}
}
}
});
dsXML.read();
$("#grid").kendoGrid(
{
columns: [{title: "Artikel Nr.", field: "itemno"},
{title: "Beschreibung", field: "description"},
{title: "VK-Preis", field: "unitprice"}],
dataSource:
{
data: dsXML
}
});
}
);
</
script
>
</
html
>