Attibutes of RadTreeNode

5 posts, 0 answers
  1. Shweta
    Shweta avatar
    3 posts
    Member since:
    Jul 2008

    Posted 16 Jul 2008 Link to this post

    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
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 16 Jul 2008 Link to this post

    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
  3. Shweta
    Shweta avatar
    3 posts
    Member since:
    Jul 2008

    Posted 17 Jul 2008 Link to this post


    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?
  4. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 17 Jul 2008 Link to this post

    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
  5. Vic
    Vic avatar
    20 posts
    Member since:
    Jun 2004

    Posted 21 Nov 2008 Link to this post

    It was not working for me either so I had to use this:

    var nodetype = node.get_textElement().getAttribute(

    "Type")

     

Back to Top