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
190
Add the node on the client
posted

Hello. I have the webdatatree and I want to add the nodes on client side, after some work on the server.

On server side I make the javascript function be called using such code

string script = "AddTreeNode('" + txtFolderName.Text + "'," + newFolderId + "," + CurrentFolderId + ")";
ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "scrCreateFolder", script, true);

 

and on client there is a function:

       function AddTreeNode(name, value, parentId) {
            var node = tree.createNode(name);
            var parentNode = SearchNodeRecur(parentId);
            var location;
            if (parentNode) {
                location = $adrutil.getLocationFromDomElement(parentNode.get_element());
                node.set_key(value);
                tree.add(node, location);
            }
        }

 

The new node is added to the parent node. But after adding, this new node, and its previous node become "empty" (i.e, without "+" image).

How can I make new node to be added with "+" before node text?

And why the previous node for added node becomes also without "+"?

Parents
No Data
Reply
  • 3726
    posted

    Hi,

    your code seems correct. I do not understand the question about the +. If you add a node A to another node B that does not have children already a plus must be displayed in front of node B.

    I saw that you have properly found the function getLocationFromDomElement(). It returns the location of the selected DOM element. If you want to add to the root level, supply null or undefined for location. If you supply "0"  node will be added as child of the first root element. If you supply "0.0" the new node will be added as first child of the first child of the first root node.

    Hope this helps.

    Thanks,

    Lubomir

Children
No Data