Keno UI TreeView Angular JS:- How to select the newly added item?

98 views Asked by At

I have an issue. I can add a new item to the tree view using this TreeView With AngularJS but i can't make this new item the selected one. How to select this new item ? This is my code that is used to add new item to the tree.

var newCreatedCompanyHierarchyItem = this.createNewCompanyHierarchyItem();
        this.$scope.tree.append(newCreatedCompanyHierarchyItem,   this.$scope.tree.select());
1

There are 1 answers

0
The Dread Pirate Stephen On BEST ANSWER

The append() method has a callback parameter that gets called once the new item has been added(after fetching siblings remotely if required). The parameter to the callback is the appended <li> element which can be used to select it:

var addedElement = this.$scope.tree.append(newCreatedCompanyHierarchyItem, this.$scope.tree.select(), function (e) {
    $scope.tree.select(e);
}));

Simple example: http://dojo.telerik.com/@Stephen/OxOMe