:: Forum >> Version 2 >>

Can right-click context menu events be different for each tree item?

More information on this topic is available in the documentation section: /aw.ui.tree/.

Hello,

Although I see how to setup a context menu for the entire tree itself, is it possible for each tree item to specify a oncontextmenu event? Therefore, each node would have a unique context menu with actions specific to that node (like copy, paste, etc. per tree item).

Like for links, I see methods that are associated with the parent tree object that reference specific ordinals in the array:

Tree.setItemLink("http://www.google.com", 1);

Likewise with mouse events such as the following, but I see no right-click / context event in the documentation.

Tree.onItemMouseOver(event, index);
Tree.onItemClicked(event, index);
etc...

If I use a method such as:

Tree.setEvent("oncontextmenu", return false; function() {});

... the context menu is specified for the tree as there's no index ordinal to setup unique context menus for each tree item.

My apologies if I'm missing something obvious, but any help would be greatly appreciated!

Thanks so much!

js
js
Wednesday, June 6, 2007
You can assign oncontextmenu html event handler to the item template and get the item index from the internal $0 property -

tree.getItemTemplate().setEvent("oncontextmenu", function(event){
    var 
index this.$0;
    
alert(index);
});
 
Alex (ActiveWidgets)
Thursday, June 7, 2007



This topic is archived.

Back to /aw.ui.tree/

Documentation:

Forum search