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

Angular TreeView sorting children of an node by index

1 Answer 388 Views
Hierarchical Data Source
This is a migrated thread and some comments may be shown as answers.
Julian
Top achievements
Rank 1
Julian asked on 12 Dec 2014, 11:49 AM
Hi,
I have an angular TreeView, and I need to reorder nodes from a specfic parent by a item property (index).
How can I do this?

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 16 Dec 2014, 09:15 AM
Hello Julian,

If you want to reorder the items of the treeview you need to change the item order in that specific level of the dataSource hierarchy - the TreeView will automatically react to the change and redraw itself.

The methods which you can use of the Hierarchical dataSource are the same that the regular DataSource has. Check the examples in the documentation:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-insert
http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-remove

Removing an item from the dataSource and inserting it at specific position should handle this reordering that you look for. To get the current items of the dataSource use the data method.

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-data

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Hierarchical Data Source
Asked by
Julian
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or