QTree - Error on dynamic addition of nodes

  • Hi, I use the below method to dynamically add a node (not to the root) but to add it to a child of the root node. The tree has lazy loading enabled.

    treeObj = this.sTreeNodes.find(o => o.key === 'someKey')
    if (treeObj.children) treeObj.children.push(newObject)
    // Check if the node contains any children (expanded or not) and then push it

    But the tree does not get refreshed immediately and on the next click I get an error:

    Error in render: “TypeError: Cannot read property ‘isParent’ of undefined”

    However, adding nodes to the root level does not give any problems.

  • hi @joeyezekiel, i did something like that, here is my code:

    request.postRequest(payload,this.$store).then( (res) => {

        	let nodo = _self.buscaNodo();
        	if(nodo !== undefined){
        			id_padre: _self.selection
        }).catch(error =>{_self.$store.dispatch("main/muestraError",error);});

    in the code i do a post request and when it comes back, i search for the selected node (in the model) where after the insert in db will be the parent node and then push the new node as child of it; after that i just add the node to the expanded array…

    i hope it can help you …

  • Thanks @peterPanParker But I am getting the same result when I tried pushing it to the expanded array. The subsequent click anywhere on the tree updates the tree.
    I am using the below code to return the results.

          this.$nextTick(function () {

    This problem has been fixed I guess, but I have the same issue here. Dynamic model creation.

  • Hi, @joeyezekiel, maybe it is your version of quasar…
    This is the page (the code) where i use qtree dynamically, you can compare codes maybe it could help you, because my page works well:


Log in to reply