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

How to insert nodes dynamically when a father node is clicked ? #23

Closed
Wenzel opened this issue Aug 9, 2018 · 2 comments
Closed

How to insert nodes dynamically when a father node is clicked ? #23

Wenzel opened this issue Aug 9, 2018 · 2 comments

Comments

@Wenzel
Copy link

Wenzel commented Aug 9, 2018

Hi @David-Desmaisons ,

I was wondering how it could be possible to insert new nodes dynamically (fetched from an external resource, like a GraphQL endpoint), when the root node is being clicked.

So far, I tried the following:

    <tree :data="tree" node-text="name" class="tree" v-on:clicked="onClicked">
    </tree>
  methods: {
    onClicked: function (event) {
      alert('Bonjour ' + this.tree.name + ' !')
      var child = {
        name: 'child01'
      }
      event.data.children.push(child)
    }
  }

And the data is indeed updated:
screenshot from 2018-08-09 11-42-06

And reflected on the Component tree attribute:
screenshot from 2018-08-09 11-42-53

-> So Is it a simple refresh problem ?
-> Can I use your component to insert dynamical data into it, or should i gather all the data from the beginning ?

Thanks David !

@Wenzel
Copy link
Author

Wenzel commented Aug 9, 2018

I find this similar issue in the closed ones: #15

But i doesn't help me much here.

David-Desmaisons added a commit that referenced this issue Aug 10, 2018
@David-Desmaisons
Copy link
Owner

Correct in version 3.6.0.

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

2 participants