We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

What data is available in the "args" of a treeview event?


I am building a Treeview and have a handler for the "NodeSelect" event. i.e. @Html.EJ().TreeView("treeView").TreeViewFields(...).ClientSideEvents(s => s.NodeSelect("OnNodeClick"))

In the Javascript that handles the event - function OnNodeClick(args) { ... } - we get passed the "args" object.

I know that "args.value" gives me the nodes text value, but how can i get the "ID" or "ParentID" from the args object? 

Thanks in advance.

1 Reply

SN Sasikala Nagarajan Syncfusion Team February 13, 2015 09:08 AM UTC

Hi Neil,

Thanks for using Syncfusion products,

We have analyzed your requirement (need Parent id, text, id as arguments in node select event).Currently in ‘nodeSelect’ event arguments we can get selected node’s value only. We have already logged this requirement as bug and a support incident has been created under your account to track the status of this requirement.


For your convenience we have prepared the workaround solution to achieve your requirement.

In node select event we can get the current element as arguments. We can use this current element and get the required fields (Pid, id, text) using jQuery traversing.

Please find the below code snippet



function OnNodeClick(args)


        var Pid =args.currentElement.parents("li").attr("id");

        var id=args.currentElement.attr("id");

        var text=args.currentElement[0].textContent;

        alert("Parent id :" +Pid +" id :"+id+" text :"+text);


Please use above code in your project to achieve your requirement until we fix the reported issue.


Sasikala Nagarajan

Live Chat Icon For mobile
Up arrow icon