jQWidgets Forums

jQuery UI Widgets Forums Navigation Tree How to get item easily?

This topic contains 1 reply, has 2 voices, and was last updated by  ivailo 9 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • How to get item easily? #79788

    yuanru
    Participant

    Hi,

    I want to check if item A is the ancestor of item B in a tree.

    But I haven’t found any methods like getItemByID().

    In order to implement the function, I have to get all items of the tree and then enumerate them round by round. It is so complicated, is there any easy ways.

    Thanks!

    How to get item easily? #79858

    ivailo
    Participant

    Hi yuanru,

    You can use getItem method for both items.
    Then you can compare the parentElement field of the first item with the element field of the second item.
    If they are equals you have parent-child relation.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.