Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #102700
    Giovanni Zomer
    Participant

    I have to refresh a subnode I have previously loaded dynamically; the easiest way would be
    – delete all the children of the group
    – reload all the children using a service

    *)
    but for doing this I would need to iterate through the nodes of a specific group: is this possible?
    if not, I would simply
    – delete the group
    – reload the children using a service

    *)
    but for doing this I would need to know the position of the node I’m going to remove, as I need to insert the new groupnode exactly at the same position;
    at the moment I’m just able to insert it at the end

    a simple way to iterate through nodes would be fine …

     

    #102705
    admin
    Keymaster

    Hi,

    By using const tree = document.querySelector(“smart-tree”) you can get the Tree’s HTML Element instance. Then you get all tree items or tree item groups, you can use tree.querySelectorAll(“smart-tree-item”); or tree.querySelectorAll(“smart-tree-items-group”); You can also query select by ID or CSS class if you set such to your tree items or groups. By having the HTML Elements stored in a variable, you can then use Smart.Tree’s API to add or remove items. I would like to suggest you to look at https://www.htmlelements.com/demos/tree/context-menu/. This example shows how to add or remove tree items dynamically depending on user selection through a context menu.

    Best regards,
    Peter Stoev

    Smart UI Team
    https://www.htmlelements.com/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.