ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: jplevene on May 20, 2024, 02:15:42 am

Title: moveNodes issue in Tree
Post by: jplevene on May 20, 2024, 02:15:42 am
I am trying to manually move a node (not with DND, using only JS) and use the following code:

Code: [Select]
$("#grid").pqGrid("Tree").moveNodes({nodes:[rowData], parent:new_parentId});
When I do above I get a JS error in pqGrid "Uncaught TypeError: t.forEach is not a function"

What am I doing wrong?
Title: Re: moveNodes issue in Tree
Post by: jplevene on May 20, 2024, 05:34:24 am
Forgot to say, error is generated in "getUniqueNodes"
Title: Re: moveNodes issue in Tree
Post by: paramvir on May 20, 2024, 07:40:16 am
Please correct the parameters.

Code: [Select]
var Tree = $("#grid").pqGrid('Tree');
Tree.moveNodes( [ rowData ], Tree.getNode( new_parentId ) );
Title: Re: moveNodes issue in Tree
Post by: jplevene on May 21, 2024, 05:09:28 pm
I tried that and it still causes the same error:

Code: [Select]
tree.moveNodes({nodes:[rowData], parent:parent});
I even tried:

Code: [Select]
tree.moveNodes({nodes:[ tree.getNode(rowData["ID"]) ], parent:tree.getNode(parent["ID"])});
Title: Re: moveNodes issue in Tree
Post by: jplevene on May 21, 2024, 05:51:04 pm
I'm only moving one node from one parent to another BTW.

Even if I don't set parent and omit it I still get the error, so the error is caused by the "nodes" value.
Title: Re: moveNodes issue in Tree
Post by: paramvir on May 21, 2024, 07:11:36 pm
There are no curly brackets {} in the parameters to moveNodes

Code: [Select]
var Tree = $("#grid").pqGrid('Tree');
Tree.moveNodes( [ rowData ], Tree.getNode( new_parentId ) );