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

Attibutes of RadTreeNode

4 Answers 121 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Shweta
Top achievements
Rank 1
Shweta asked on 16 Jul 2008, 12:56 PM
Hi,

Can anyone tell me how to access attributes assigned for a RadTreeNode in client side programming?

I tried "node.get_attributes().getAttribute("<Attr_name>"), but its returning me value as 'undefined'.

I also want to know how to get count attributes associated with a particular RadTreeNode.

Thanks,
SK

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 16 Jul 2008, 01:18 PM
Hi Shweta,

You may find this help topic useful. It describes how to access attributes on the client-side.

Getting the attribute count is easy:

node.get_attributes().get_count();

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shweta
Top achievements
Rank 1
answered on 17 Jul 2008, 06:59 AM

Thanks for your reply.

I referred to the same document which you have given the link for, still I am getting error.

I am setting an attribute at server-side code and accessing the same at client-side by node.get_attribues().getAttribute("<attribute_name>") as mentioned in the document.

When I set alert(node.get_attributes().getAttribute("<attribute_name>")) for this I get undefined in return.

Also, when I take count of attributes using  node.get_attributes().get_count(), it returns me '0'.

Is there any other way I set/access attributes for RadTreeNode?
0
Atanas Korchev
Telerik team
answered on 17 Jul 2008, 07:11 AM
Hi Shweta,

This is supposed to work. Please check our online example here.

Could you please verify on the server side that you are setting the attributes for the correct node? You can also check the rendered output of your treeview for the presence of the custom attribute in the JSON e.g.:

{"attributes":{"Position":"Senior Developer","Phone":"555-888-502","Room":"502","Email":"mashona.washington@example.com"}}]
I hope this helps,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Vic
Top achievements
Rank 1
answered on 21 Nov 2008, 07:25 PM
It was not working for me either so I had to use this:

var nodetype = node.get_textElement().getAttribute(

"Type")

 

Tags
TreeView
Asked by
Shweta
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Shweta
Top achievements
Rank 1
Vic
Top achievements
Rank 1
Share this question
or