Tree not updating

I have a tree object. The objects ID = resourceTreeGrid

I’m trying to a local add using tree.add()

The id field of the tree is ItemLoc

My script looks like this

functionaddTreeItem(name,parent,itemLoc){
alert(“Name:”+name+"
“+“Parent:”+parent+”
“+“ItemLoc:”+itemLoc);
var selectedNode = resourceTree.getSelectedRecord();
alert(selectedNode.ItemLoc+” "+selectedNode.ReportsTo);
resourceTreeGrid.add({ItemLoc:itemLoc, ReportsTo:parent, NAME:name,BRANCH:“private”,ISFOLDER:“true”},parent);
}

The alerts are my debug stuff. I can clearly see the right stuff is coming in, and as long as the node I’m putting this child into reports to the parent, and it should adding it to the parent. It should refresh. I get no firebug alert. Its looks like I’m firing off correctly.

Any ideas about what I’m doing wrong?

You’re calling add() on a TreeGrid whereas that’s an API on Tree. See the docs for Tree - it’s accessible as treeGrid.data.

I tried the tree itself and I get a message

add not a function