This is a migrated thread and some comments may be shown as answers.

How to apply CSS [cursor="hand"] to last nodes using Javascript

1 Answer 72 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
parimal
Top achievements
Rank 1
parimal asked on 25 Nov 2008, 03:50 AM
Hi,

I have dynamically generated treeview and i wish to apply defined css class to last node of each parent node using js on 

OnClientNodeExpanded event.

 

<

 

script language="javascript" type="text/javascript">

 

 

 

 

 

 

function ApplyCSS(sender, eventArgs)

 

{

 

////var treeView = $find("<%=tvCategories.ClientID%>");

 

 

 

 

 

 

//var selectedNode = treeView.get_selectedNode();

 

 

 

 

 

 

var node =eventArgs.get_node();

 

alert(node.get_nodes().get_count());

 

if(node.get_nodes().get_count()>0)

 

{

 

for(var i = 0; i < node.get_nodes().get_count(); i++){

 

 

//WHAT SHOULD BE THE CODE HERE?
 i tried but gives error.

 

node.get_nodes().getNode(i).style.cursor = 'hand'; ;

}

}

 

}

regards,
Parimal

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 Nov 2008, 02:44 PM
Hi parimal,

The error occurs because the client-side object representing a tree node does not have a "style" property. Only DOM elements have it. You can try this instead:

node.get_nodes().getNode(i).get_element().style.cursor = 'pointer'; ;

Also you should use cursor="pointer" for cross browser reasons.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
parimal
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or