No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    QTree - Error on dynamic addition of nodes

    Help
    2
    4
    1372
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      joeyezekiel last edited by joeyezekiel

      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.

      P 1 Reply Last reply Reply Quote 0
      • P
        peterPanParker @joeyezekiel last edited by

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

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

          		_self.$store.dispatch("main/muestraMsg",res);
            	let nodo = _self.buscaNodo();
            	if(nodo !== undefined){
            		nodo.children.push({
            			id:res.data.id_paquete,
            			label:_self.paquete.nombre,
            			lazy:true,
            			id_padre: _self.selection
            		});
            		_self.expanded.push(nodo.id);
            	}
        	
            }).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 …

        1 Reply Last reply Reply Quote 0
        • J
          joeyezekiel last edited by joeyezekiel

          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 () {
                   done(objData)
               })
          

          This problem has been fixed I guess, but I have the same issue here. Dynamic model creation.
          https://github.com/quasarframework/quasar/issues/1200

          P 1 Reply Last reply Reply Quote 0
          • P
            peterPanParker @joeyezekiel last edited by peterPanParker

            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:

            https://github.com/okamismo/pmt/blob/master/client/src/pages/edt.vue

            1 Reply Last reply Reply Quote 0
            • First post
              Last post