Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Adding childs under nodes always getting created under root node.
posted

I am working on mulitple WebDataTree's in a single page on different tabs.

As per requirement, user should be able to create new childs under any selected node of the current displayed tree. I am creating nodes in WebDataTree using WebDataMenu (Context menu). User can create a node by right clicking on 'Create' menu item of WebDataMenu control.

I am using javascript functions of infragistics to create nodes and it creates first child successfully under the selected node but if I want to create child under newly created node, it always creates under the root node. Can anybody suggest how to fix this.

Please suggest asap.

following javascript code i wrote on WebDataMenu click:

 

function MenuItem_Click(menu, eventArgs) {

            var type = eventArgs.getItem().get_key();
            var menuName = eventArgs.getItem().get_text();

            var oItem = menu;
            var currentTree = GetCurrentTree(); // it gives me current tree

            var node = null;
            var address = null;

            node = currentTree.get_selectedNodes()[0]; // getting selected node reference
            parentId = node.get_valueString(); // getting Node Id

            var newNode = new Object(); //json object

            newNode.ParentId = parentId;

            var resData = SendReqForNewAsset(newNode); //sending request to service

            address = $adrutil.getAddressFromDomElement(node.get_element()); // getting address of current selected node

            var newnode1 = currentTree.createNode(resData.d.NodeName);
            newnode1.set_valueString(resData.d.NodeId);

            //trying to set the image and navigation url of the node -- but not working
            newnode1._element.setAttribute('igUrl', resData.d.NavigationUrl);
            newnode1._element.setAttribute('igSelImage', resData.d.SelImageUrl);
            newnode1._element.setAttribute('igUnselImage', resData.d.ImageUrl);
                      
            currentTree.add(newnode1, address);

            }
        }

 

Also I want to know that

1) how to select the newly created node in javascript and unselected currently selected node.

2) how to set SelImageUrl and UnSelImageUrl to a node in WebDataTree like ultrawebtree.

Parents Reply Children
No Data