0

I am very new to angular and have created a treeview using the following example: jsfiddle.net/eu81273/8LWUc/18/

This is the datastructure i use:

treeview1 = [
                {
                    roleName: "User2", roleId: "role2", type: "region", "children": [
                    { roleName: "subUser2", roleId: "role21", collapsed: false, type: "branch", children: [] },
                    {
                        roleName: "subUser21", roleId: "role22", collapsed: false, type: "divison", children: [
                        {
                            roleName: "subUser2-1", roleId: "role211", type: "branch", children: [
                            { roleName: "subUser2-1-1", roleId: "role2211", type: "branch", children: [] },
                            { roleName: "subUser2-1-2", roleId: "role2212", type: "branch", children: [] }
                            ]
                        }
                        ]
                    }
                    ]
                },

                {
                    roleName: "User3", roleId: "role3", children: [
                    { roleName: "subUser3", roleId: "role31", collapsed: false, children: [] },
                    {
                        roleName: "subUser31", roleId: "role32", children: [
                        {
                            roleName: "subUser3-1", roleId: "role3121", "children": [
                            { roleName: "subUser3-1-1", roleId: "role3221", children: [] },
                            { roleName: "subUser3-1-2", roleId: "role3222", children: [] }
                            ]
                        }
                        ]
                    }
                    ]
                },

                {
                    roleName: "User4", roleId: "role4", children: [
                    { roleName: "subUser4", roleId: "role41", children: [] },
                    {
                        roleName: "subUser41", roleId: "role42", collapsed: false, "children": [
                        {
                            roleName: "subUser4-1", roleId: "role431", children: [
                            { roleName: "subUser4-1-1", roleId: "role4231", children: [] },
                            { roleName: "subUser4-1-2", roleId: "role4232", children: [] }
                            ]
                        }
                        ]
                    }
                    ]
                }
        ];

I now have 2 buttons below the treeview, Move Up and Move Down. If I select a leaf node and click on Up it should move to the previous available parent. If I click on down, it should move to the next available parent.

I have tried deleting it from the tree and adding it to a node but have had no success. Could someone help me with this please?

Thanks!

1 Answer 1

0

I checked for all the possibilities and as per in depth analysis on this, this is not feasible.

The only thing which can be done is the selection of child nodes of the current node (selected) with the help of below code:

$scope.nextNode = function () {
    $scope.tree01.selectNodeHead($scope.tree01.currentNode.children[0]);
    $scope.tree01.selectNodeLabel($scope.tree01.currentNode.children[0]);
};

Here nextNode is the function call on click of the Next button.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.