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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

118222 Feb 12,2015 06:53 AM Feb 13,2015 04:08 AM ASP.NET MVC 1
loading
Tags: TreeView
Neil Partington
Asked On February 12, 2015 06:53 AM

Hi,

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.

Sasikala Nagarajan [Syncfusion]
Replied On February 13, 2015 04:08 AM

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.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

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

[script]

 

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.

Regards,

Sasikala Nagarajan



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;