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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can a link in a treeview node respond to its own event handler?

Thread ID:





119664 Jul 20,2015 03:27 PM UTC Jul 22,2015 03:59 AM UTC JavaScript 1
Tags: ejTreeView
Randy Craven
Asked On July 20, 2015 03:27 PM UTC


I have a TreeView using templates.  I am wondering if it's possible to have a link inside of a node that responds to it's own click event and not the nodeClick event of the tree.  For example here is a template:

<script id="treeTemplate" type="text/x-jsrender">
        <td><a onclick="{{>SomeURL}}"><img src="{{>SomeIconPath}}" /></a></td>

So, clicking the <img/> tag would fire the onClick event of the anchor tag, and not the nodeClick event of the tree.



Sasikala Nagarajan [Syncfusion]
Replied On July 22, 2015 03:59 AM UTC

Hi Randy,
Thanks for using Syncfusion products,

We have analyzed your query. We can achieve your requirement using our link Attribute feild property of Treeview. This property is used to set the hyper link of node. We have prepared the simple sample based on this. Please get the sample from below location


If you didn’t need treeview node click event in this case, you can achieve this by cancelling the particular event. This can be done by setting cancel argument value to true(cancel is one of the argument of node click event).Please refer the below code snippet


fields: {

dataSource: treeData,

id: "id", parentId: "pid", text: "name", hasChild: "hasChild", linkAttribute: "linkAttribute"


template: "#treeTemplate", nodeClick: "nodeClick"


function nodeClick(args) {

args.cancel = false;


Please check with the provided sample and let us know if you have further queries,
Sasikala Nagarajan


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon