Home > Net >  vue-jstree does not open children when loading data via api
vue-jstree does not open children when loading data via api

Time:12-13

   <v-jstree :data="data"
              textFieldName="name"
              @item-click="itemClick"
    />

If I use statics - then this works:

data() {
        return {
            data: [
                {
                    "name": "title 1",

                    "children": [
                        {
                            "name": "Child 1",
                        },
                        {
                            "name": "Child 2",
                        },
                    ]
                }
            ]
        }

        },

If I use ajax, then all data is loaded, but openChildren doesn't work(

Response comes in the correct format:

[{ "id": 1, "name": "Title", "children": [{ "id": 1, "name": "Child 1" }, { "id": 2, "name": "Child 2" }.......

children are also loaded, why does the functionality break down?

CodePudding user response:

By trial, I found a way to solve it) in the server response in parent, the "opened" parameter must be specified , either true or false

  • Related