简体   繁体   中英

Angular ivh-treeview all nodes expand by default

Working on AngularJS ivh-treeview.

I want to see all child nodes expanded by default.

Currently this is my tree structure:

 $rootScope.nodes= [{
        label: 'node1',
        value: 'node1',
        enable:true,
        children: [{
            label: 'child1',
            value: 'child1',
            enable:true,
            children: [{
                label: 'child2',
                value: 'child2',
                enable:true,
            }]
        },{
            label: 'node2',
            value: 'node2',
            enable:true,
        }]
    }];

Currently there is a + sign on left side of child1 label. It also has a sub child which is child2 but i have to click on the + sign to view it.

Also when i drag a node in child1 i am not able to see it and i have to click on the + sign to view it.

I want to view all the child nodes by default. I mean there should be no need to click on the + sign when i drag a new node.

I had found a solution for this which is :

ivh-treeview-expand-to-depth="2"

but in this we have to specify a value...like above...i want to pass something in this like

ivh-treeview-expand-to-depth="*" OR ivh-treeview-expand-to-depth="infinite"

So that i can view all the child nodes by default or when ever i drag a new node it should be visible.

You can use ivh-treeview-expand-to-depth="-1" to expand all nodes by default. See the Expand by Default section of the project's README: https://github.com/iVantage/angular-ivh-treeview#expanded-by-default . Is that what you were looking for?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM