Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any examples for working with a pre-existing data structure? #91

Open
egeersoz opened this issue Feb 25, 2021 · 0 comments
Open

Any examples for working with a pre-existing data structure? #91

egeersoz opened this issue Feb 25, 2021 · 0 comments

Comments

@egeersoz
Copy link

Trying to have sl-vue-tree display an existing nested data structure. Example:

{"Activities": [
  {
    "Options": {
      "User ID": 1000
    },
    "Name": "Find Projects",
    "Activity Type ID": 5
  },
  {
    "Name": "For Each Project",
    "Activity Type ID": 6,
    "Activities": [
      {
        "Name": "Find the Project",
        "Activity Type ID": 4
      },
      {
        "Name": "Assign Task",
        "Activity Type ID": 7
      },
    ]
  }
]
}

I managed to have sl-vue-tree display the top nodes using this:

this.activities = this.process.Activities.map(activity => {
   return {
       title: activity.Name,
       'children?': activity.Activities,
       'isLeaf?': true,
       'isExpanded?': true,
       'isSelected?': false,
       'isDraggable?': true,
       'isSelectable?': true
     }
  })
})

But the second one, which has children, won't expand and show them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant