The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

budhines57 (1) [Avatar] Offline
I am working on Section: 11.4.4. Creating Nodes for our TreePanel. I am using the logic for the onCompleteAdd for the contextmenu. I am attempting to get the parentNode so I can pass it to the addnode.php routine. This way, by examining the parentNode passed as parameter I can determine whether my routine should add a department, subdepartment (my tweak) or add an employee.

I can retrieve the parentNode on the click event and it works:
var parentNode = node.parentNode;

I was going to say it does not work but while writing this up I came up with my solution:

under var treePanel = Ext.getCmp('west-panel');
I added:
var selNode = treePanel.getSelectionModel().getSelectedNode();

then, under the params I changed:
newName: newValue


newName: newValue,
oldName:, (provides the parent node id)
oldText: selNode.text (provides the name of the parent node)

So you are now passing not only the new value but also passing the id of the parent node and the name of the parent node.

I just thought I would pass this along to anyone else who wanted to pass this information to their php routine. This makes knowing whether you are adding a department or an employee much easier.