May 07, 2013, 11:54 AM
[CLOSED] Update CycleButton MenuItems in DirectEvent
Hi,
I would like to update the menuitems of a CycleButton during a directevent. This seems to work only parial, the new items are added to the menu, but the active/checked item is not set (the initial menu item is still the selected). Also the cycle functionality does not work.
Hope you can help, thnx,
Sander
Ext.NET version: 2.2.0.21675
Tested with Chrome & IE8
I would like to update the menuitems of a CycleButton during a directevent. This seems to work only parial, the new items are added to the menu, but the active/checked item is not set (the initial menu item is still the selected). Also the cycle functionality does not work.
Hope you can help, thnx,
Sander
Ext.NET version: 2.2.0.21675
Tested with Chrome & IE8
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<script runat="server">
public void OnTstBtnClick(object sender, DirectEventArgs e)
{
CycleButton1.Menu[0].RemoveAll();
var mi = new CheckMenuItem
{
ID = "cmi1",
Text = "cmi1",
Icon = Icon.World,
};
CycleButton1.Menu[0].Items.Add(mi);
mi.Render();
mi = new CheckMenuItem
{
ID = "cmi2",
Text = "cmi2",
Icon = Icon.Accept,
Checked = true
};
CycleButton1.Menu[0].Items.Add(mi);
mi.Render();
CycleButton1.Menu[0].ActiveIndex = 1;
}
</script>
<html>
<head id="Head1" runat="server">
<title>CycleButton test</title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:FormPanel ID="formPanel" runat="server"
Width="400"
Height="200"
Title="CycleButton menu update test">
<Items>
<ext:CycleButton ID="CycleButton1" runat="server" ShowText="true" PrependText="View As ">
<Menu>
<ext:Menu ID="Menu1" runat="server">
<Items>
<ext:CheckMenuItem ID="CheckMenuItem1" runat="server" Text="Text Only" Icon="Note" />
<ext:CheckMenuItem ID="CheckMenuItem2" runat="server" Text="Html" Icon="Html" Checked="true" />
</Items>
</ext:Menu>
</Menu>
</ext:CycleButton>
</Items>
<Buttons>
<ext:Button ID="tstBtn" runat="server" Text="Change menu items">
<DirectEvents>
<Click OnEvent="OnTstBtnClick" />
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
</form>
</body>
</html>
Last edited by Baidaly; May 08, 2013 at 9:20 PM.
Reason: [CLOSED]