Skip to content

Deeper level tree issue #67

Open
Open
@VasilisNikiforidis

Description

@VasilisNikiforidis

Hi!

I tried deleting some items from a nested tree I created, but it failed beyond the 1st split.

My code:

getDeletedItem(item,name){
      var flatName = item.parent.text+"/"+name
      if(Object.keys(item.parent.parent).includes('text')){
        console.log(Object.keys(item.parent))
        flatName = this.getDeletedItem(item.parent,flatName)
      }
      return flatName
}

deleteMenuItem(name) {
      var item = this.$refs.tree.getNodeById(name)
      this.$refs.tree.deleteNode(item)
      console.log(this.getDeletedItem(item,item.text))
}

Part of my tree is like this:

parent1
     parent2
          child1
     parent3
          child2
parent4
parent5
     child3

My problem is that when i use getNodeById(name) (where name is the Id i set for each item) I get an object with only the direct parent and when I expand parent in the console to see what is in there, there is no additional parent item as I would expect.
For example in the above schema, getNodeById for child1 has parent item with details for parent2 but parent 2 does not include a parent item for parent1.
Though when I print the whole tree I do not have this issue.

Any help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions