This is a migrated thread and some comments may be shown as answers.

Angularjs + kendo-ui treeview.

2 Answers 211 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jose Mejia
Top achievements
Rank 1
Jose Mejia asked on 26 Aug 2013, 06:26 PM
Hi.
I'm trying to use  angular-kendo framework and it seems pretty cool!
But I can't to make working treeview...
I use following angular controller:
function HomeCtrl($scope)
{
 $scope.things = {dataSource: [{ name: "Thing 1", id: 1 },{ name: "Thing 2", id: 2 },{ name: "Thing 3", id: 3 }]}
}
and following template:

<div  kendo-treeview   <br>        
k-data-source="things"        
k-data-text-field="'name'" />
But it doesn't work...  While other controls taken from sample angular-kendo framework like grid
work great.

This chunk of code also works:
<div id="treeview"></div>
<script>
$("#treeview").kendoTreeView({
  dataTextField: [ "name"],
  dataSource: [{ name: "Thing 1", id: 1 },{ name: "Thing 2", id: 2 },{ name: "Thing 3", id: 3 }]
});
</script>


What I'm doing wrong?

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Burke
Telerik team
answered on 28 Aug 2013, 03:48 PM
Hello,

It's actually because it's kendo-tree-view.  That's confusing - I know.  I am thinking about adding a different entry point to the directives that closely mimics the jQuery one.

But more than that, there appears to be an issue with the TreeView directive.  Would you please open an issue on this over on the GitHub repo?  That is where we are tracking and closing issues.

Here is a Plunker to get you started.  You can provide this when you open the issue.

http://plnkr.co/edit/tpl:wj0Q4i1RKJu9G2UquC7d?p=preview 

Regards,
Burke
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jose Mejia
Top achievements
Rank 1
answered on 29 Aug 2013, 10:03 AM
Thank you for reply, Burke!

There is already exists github issue -- https://github.com/kendo-labs/angular-kendo/issues/79.

For now I have ugly workaround:
<div id="treeview"></div>
<script>
 
    var ds = angular.element('[ng-controller=HomeCtrl]').scope().things;
    console.log(ds)
    $("#treeview").kendoTreeView({
        dataTextField: ["name"],
        dataSource: ds
    });
</script>
Tags
General Discussions
Asked by
Jose Mejia
Top achievements
Rank 1
Answers by
Burke
Telerik team
Jose Mejia
Top achievements
Rank 1
Share this question
or