Angular TreeView sorting children of an node by index

2 posts, 0 answers
  1. Julian
    Julian avatar
    1 posts
    Member since:
    Dec 2012

    Posted 12 Dec 2014 Link to this post

    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?
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 16 Dec 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top