Today I've noticed that when using an XML DataSource in a TreeView, KendoUI complains about level method not being defined.
As far as I've seen this method is defined in Data Model but seems that for XML DataSources the code follow a different path and level is not defined.
Given the XML:
And the following JavaScript code for defining the grid and the datasource:
It complains about level not being defined.
If I add into the model a level function returning any number then it works.
Is this a bug or XML datasources are not supported in Kendo UI TreeView widgets?
As far as I've seen this method is defined in Data Model but seems that for XML DataSources the code follow a different path and level is not defined.
Given the XML:
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
standalone
=
"yes"
?>
<
root
>
<
doc
>
<
nome
>fabio</
nome
>
</
doc
>
<
doc
>
<
nome
>mauro</
nome
>
</
doc
>
</
root
>
var
ds =
new
kendo.data.HierarchicalDataSource({
transport: {
read: {
url :
"kendoTWData.xml"
,
dataType:
"xml"
}
},
schema : {
type :
'xml'
,
data :
'/root/doc'
,
model: {
fields: {
nome:
"nome/text()"
}
}
}
});
$(
"#treeview"
).kendoTreeView({
dataSource : ds,
dataTextField:
"nome"
});
If I add into the model a level function returning any number then it works.
model: {
fields: {
nome:
"nome/text()"
},
level :
function
() {
return
0;
}
}