1. #1
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    941
    Vote Rating
    65
    westy is just really nice westy is just really nice westy is just really nice westy is just really nice

      0  

    Default [Rc2] Ext.menu.Item.parentMenu gone?

    [Rc2] Ext.menu.Item.parentMenu gone?


    It's always undefined for me, for an item on a tree context menu.

    Am looking into it, but wondering if anyone else seen it?
    Was fine with RC1 earlier today...
    Product Architect
    Altus Ltd.

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Please provide a small code example if you cannot find the problem. I see it still is in the API docs:
    (4.1RC2): /docs/#!/api/Ext.menu.Item-property-parentMenu

    Regards,
    Scott.

  3. #3
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    941
    Vote Rating
    65
    westy is just really nice westy is just really nice westy is just really nice westy is just really nice

      0  

    Default


    Hmm, onRemoved is being called, which deletes the parentMenu member.


    Ahh, I have a listener in my tree view that ensures the menu gets destroyed.
    So that event is being raised before the action handler is called...

    Damn.
    Product Architect
    Altus Ltd.

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    We have all been there

    Scott.

  5. #5
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    941
    Vote Rating
    65
    westy is just really nice westy is just really nice westy is just really nice westy is just really nice

      0  

    Default


    Here's the situation.

    My tree has many different types of node on it, with each one having actions that can be performed on them.
    Therefore, on any rightclick a context menu is dynamically built and shown... when an item is selected an action is executed.

    Since the menu is dynamic I need to ensure it is cleaned up.
    I was doing this on a hide event listener, calling destroy.

    The problem is, the actions need to access the parentMenu of the clicked item, since some details of the node that was clicked on is attached to it...

    So, I need to ensure the menu is destroyed, but not until the action has been performed...
    Ahh, do actions have a callback? That's the obvious route... will look into it.
    Product Architect
    Altus Ltd.

  6. #6
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    941
    Vote Rating
    65
    westy is just really nice westy is just really nice westy is just really nice westy is just really nice

      0  

    Default


    Quote Originally Posted by scottmartin View Post
    We have all been there

    Scott.
    Hehe, indeed

    I see onRemoved is new, so I was getting away with it before it seems.
    Product Architect
    Altus Ltd.

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,050
    Vote Rating
    657
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Perhaps a removeAll would be more appropriate? That way you always retain the menu reference, you're just replacing the children.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  8. #8
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    941
    Vote Rating
    65
    westy is just really nice westy is just really nice westy is just really nice westy is just really nice

      0  

    Default


    Quote Originally Posted by evant View Post
    Perhaps a removeAll would be more appropriate? That way you always retain the menu reference, you're just replacing the children.
    Yeah, quite possibly, although will have to pick the code to bits
    Think it could work though, yeah.
    Product Architect
    Altus Ltd.

  9. #9
    Ext JS Premium Member westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    941
    Vote Rating
    65
    westy is just really nice westy is just really nice westy is just really nice westy is just really nice

      0  

    Default


    Yep, that works, thanks for the suggestion Evan.
    Product Architect
    Altus Ltd.

Thread Participants: 2