0

Context Menu, identify context

asked 2015-01-15 08:47:58 +0800

avidD gravatar image avidD
166 2

Hi, I have a large list of objects which supports a context menu. I can define a context menu per item and write use a distinct event handler for each item. However, due to some bug I had to turn off render-on-demand. Now, all the context menus for the different items are rendered even though they are not visible. I now switched to using a single context menu for the whole list. The menu shows up fine. But I don't know how to identify the list item that was clicked, i.e., the context. Is there any way to identify the object where the context menu was opened?

Cheers, David

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2015-01-15 18:21:07 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Any event have a target.

event.getTarget()

try to debug/cast this until you get the initiator.

link publish delete flag offensive edit
0

answered 2015-01-20 16:28:07 +0800

avidD gravatar image avidD
166 2

This, unfortunately, only returns the tree item which does not help. The fix was to set a custom attribute on the menu (or the item) onOpen and read it onClick of the item.

Thanks anyhow.

link publish delete flag offensive edit
0

answered 2015-01-20 18:33:51 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

with .getData() you get the Object that is bound to the treeitem.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-01-15 08:47:58 +0800

Seen: 14 times

Last updated: Jan 20 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More