I'm trying to using Kendo TreeView with attribute data initialization, following the official documentation.
As far as I understand, the next two portions of code should be equivalents:
As far as I understand, the next two portions of code should be equivalents:
1.- data attribute initialization style:
<
div
id
=
"treeview-right"
data-role
=
"treeview"
data-source
=
"inline"
data-text-field
=
"['categoryName', 'subCategoryName']"
>
</
div
>
2.- JQuery style:
<script>
$(
"#treeview-right"
).kendoTreeView({
dataSource: inline,
dataTextField: [
"categoryName"
,
"subCategoryName"
]
});
</script>
The way number 2 works as expected, but the number 1 renders the tree
but without the parent node's text(showing 'undefined' text, like it
doesn't recognize the 'categoryName' parameter from data-text-field
value. By the way , when I set data-text-field to data-text-field="[
'categoryName'
]
it shows the parent node text, but not the child node's text, as expected.
I'm using the examplefrom the official tutorial (JQuery style initialization),
if someone wants to see the whole code. Is it correct my supposition?,
Why with attribute data initialization doesn't work? .