0 Replies Latest reply on Aug 21, 2009 5:17 PM by emansouri

    Extending ContextMenuItem?

    emansouri Level 1

      Hello,

       

      I have a situation that comes up repeatedly and I am thinking there is a better way to handle it than I am handling it yet I am unaware of it and hoping someone may have some leadership they can apply here.

       

      The ContextMenuItem class is marked final so  it can't be extended.

       

      It doesn't provide any generic property, such as data, that you can add information to.  Such information could be useful in an event handler firing upon a ContextMenuEvent.MENU_ITEM_SELECT event to more easily tie together a ContextMenuItem that was selected and its relationship with other data structures.

       

      My technique for dealing with this has been to create a generic Object and add properties to it where the property value is a ContextMenuItem and its value is some data I want to correlate it to but again, I feel there is or should be a better way to deal with this.  In the selectHandler for the ContextMenuItem, I then refer to the Object's property in question as event.target will be the property name and the property value will be the data I am interested in.