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
25
igTree add node dynamically
posted

Hi,

I am using igtree to add tree node dynamically.But i am not able to see the text of the newly created treenode.

This is my reference http://ko.infragistics.com/products/jquery/sample/tree/add-remove-node-api

To create tree i am using a model class

//modal class

public string Name { get; set; }
        public float Value { get; set; }
        public virtual List TreeNodes { get; set; }

//tree

 @(Html.
                    Infragistics().
                    Tree().
                    ID("MVCBoundTree").
                    SingleBranchExpand(true).
                    Bindings( bindings => {
                        bindings.
                        TextKey("Name").
                        ValueKey("Value").
                        ChildDataProperty("TreeNodes");
                    }).
                    DataSource(Model).
                    DataBind().
                    Render()
                )

//adding node dynamically

$("#btnLevelCategory").click(function () {
            var selectedNode = $("#MVCBoundTree").igTree("selectedNode").element;
            var selectedPath = $("#MVCBoundTree").igTree("selectedNode").path;
            
            if (selectedNode != null) {


                // Create new node
                var newNode = {
                    Text: "My New Node",
                    Value: Math.floor(Math.random() * 1001)
                };

                // Add node to Tree
                $("#MVCBoundTree").igTree("addNode", newNode, selectedNode);
                
                
                // and expand node
                $("#MVCBoundTree").igTree("expand", selectedNode);
            }
        }); 

I can see a new item added , but the text is always coming as empty.Why is the text of new node coming as empty?

Regards,

Balu

Parents
  • 25
    posted

    Hi,

    Is this a bug in infragistics?

    I read in the forum that Infragistics tree doesn't allow dynamic addition of tree.

    Any update on this post?

    Regards,

    Balu

Reply Children
No Data