Feb 22, 2013, 1:50 AM
[OPEN] [#159] Can't share menu across different toolbar buttons
We have a page with many panels and toolbar buttons with menus. To optimize performance in 1.x, you recommend to create one menu and share it across all buttons. In 2.x, I can't get a reference to the panel the menu currently is in. Click on the Menu Item in panel one, it will alert panel two's title.
<html>
<head id="Head1" runat="server">
</head>
<body>
<script type="text/javascript">
var menu = new Ext.menu.Menu({
items: [{
text: 'Menu Item',
handler: function () {
alert(this.getRefOwner().up('panel').title);
}
}]
});
</script>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" Theme="Gray"
DisableViewState="true" />
<ext:Panel runat="server" Title="Panel One" Width="400" Height="100" Layout="FitLayout">
<TopBar>
<ext:Toolbar runat="server">
<Items>
<ext:Button runat="server" ID="btnOne" Text="One">
<CustomConfig>
<ext:ConfigItem Name="menu" Value="menu" Mode="Raw">
</ext:ConfigItem>
</CustomConfig>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Items>
</Items>
</ext:Panel>
<ext:Panel ID="Panel1" runat="server" Title="Panel Two" Width="400" Height="100" Layout="FitLayout">
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button runat="server" ID="Button1" Text="Two">
<CustomConfig>
<ext:ConfigItem Name="menu" Value="menu" Mode="Raw">
</ext:ConfigItem>
</CustomConfig>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<Items>
</Items>
</ext:Panel>
</form>
</body>
</html>
Last edited by Daniil; Mar 05, 2013 at 6:33 AM.
Reason: [OPEN] [#159]