Hello
I'm using a TreeView that is working fine but I always got an error message when using the findByText function. It took my a good time to find out what the problem is: I am using a template on initializing the TreeView. If I disable/remove the template on initializing the TreeView the findByText function works great. If the template is active I got an error message on using findByText function:
[Error] TypeError: undefined is not an object (evaluating 'o.loaded') kendo.all.min.js :38:19209
var objectView = $("#treeview").data("kendoTreeView");
objectView.append({ text: "append1" }, $("#treeview .k-item:last")); // --> Works with and without template
var foo = objectView.findByText("Game");
objectView.append({ text: "append2" }, test); // --> Works only without template
DataSource used in TreeView:
var treeEmpty = [
{text: "Game",id: -1, type: "game", expanded: true, spriteCssClass: "fa fa-globe fa-fw", items: [
//{ text: "Mein Game", id: -2, type: "spot"},
{ text: "Spots", id: -2, type: "spot", spriteCssClass: "fa fa-map-marker fa-fw"},
{ text: "Characters", id: -3, type: "character", spriteCssClass: "fa fa-user fa-fw"},
{ text: "Items", id: -4, type: "item", spriteCssClass: "fa fa-key fa-fw"}
]
}
];
Template used in TreeView:
<script id="treeview-template" type="text/kendo-ui-template">
#: item.text #
# item.id #
# if (item.id < 0) { #
<a class="fa fa-plus-circle fa-fw handpointer"> </a>
# } #
</script>
I must assume that the usage of a template in a TreeView changes the default structure so certain functions do not work anymore. How else can I append entries/items to TreeView when using a template?