PDA

View Full Version : [CLOSED] Proper way to get the Tree NodeID in the TreePanel ItemContextMenu handler



CarpFisher
Sep 25, 2012, 1:04 PM
Hi

I've got an ItemContextMenu listeners of a TreePanel. In the node object that passed to the Handler is a DOM object, and not a TreeNode object. Using
node.id actually doesn't help in getting the actual NodeID of the treeNode. After examining all properties in that node object I find that the property
node.viewRecordId is actually containing the NodeID of the treeNode. My question, is that the reliable way to retrieve the NodeID? Is there a more proper way to get that NodeID instead? Thanks

Daniil
Sep 25, 2012, 1:47 PM
Hi,

Please use

node.getId();

See also
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Model-method-getId

CarpFisher
Sep 26, 2012, 10:20 AM
But the node passed there is a normal Dom HTMLTableRowElement, and not an Ext object.....

Here is the error from the javascript:
Uncaught TypeError: Object #<HTMLTableRowElement> has no method 'getId'

Daniil
Sep 26, 2012, 10:31 AM
Please use the second argument, not the third one.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.panel.Table-event-itemcontextmenu

CarpFisher
Sep 26, 2012, 11:31 AM
Thank you so much and it works. The reference link provided is incorrect and it should actually be:

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.tree.Panel-event-itemcontextmenu


I'm using the Handler and therefore rely on the naming of the parameters passed to the Handler by Ext.Net code. The 2nd parameter that passed to the Handler, well as one can guess, is named
record from the API.

Thanks for your help again.

Daniil
Sep 26, 2012, 2:04 PM
The reference link provided is incorrect and it should actually be:

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.tree.Panel-event-itemcontextmenu


Ext.tree.Panel inherits this event from Ext.panel.Table.



I'm using the Handler and therefore rely on the naming of the parameters passed to the Handler by Ext.Net code. The 2nd parameter that passed to the Handler, well as one can guess, is named
record from the API.

This example helps to know the arguments names in Ext.NET.
http://examples2.ext.net/#/Events/Listeners/Arguments/

CarpFisher
Sep 26, 2012, 3:14 PM
That's a cool utility!!!! i don't know that exist!! i wish i know that much earlier!!

Daniil
Sep 26, 2012, 7:46 PM
Nice that you like it! It appeared just a few days ago.