-
4 Apr 2012 4:45 AM #1
[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.
-
4 Apr 2012 4:50 AM #2
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.
-
4 Apr 2012 4:59 AM #3
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 Apr 2012 5:03 AM #4
We have all been there

Scott.
-
4 Apr 2012 5:13 AM #5
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.
-
4 Apr 2012 5:14 AM #6
Product Architect
Altus Ltd.
-
4 Apr 2012 5:20 AM #7
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!
-
4 Apr 2012 5:21 AM #8
Product Architect
Altus Ltd.
-
4 Apr 2012 5:39 AM #9
Yep, that works, thanks for the suggestion Evan.
Product Architect
Altus Ltd.


Reply With Quote


