View Full Version : [CLOSED] CycleButton setActiveItem

Oct 16, 2014, 6:23 PM
I would like to set the active item for a CycleButton, but all I have is the text for one of the CheckMenuItems in the CycleButton.

<ext:CycleButton ID="CycBtn" runat="server" ClientIdMode="Static" ShowText="true" PrependText="<b>Type: </b>">
<ext:Menu runat="server">
<ext:CheckMenuItem runat="server" Text="Title" Icon="Cog" />
<ext:CheckMenuItem runat="server" Text="Description" Icon="Cog" />
<ext:CheckMenuItem runat="server" Text="ByPass" Icon="Cog" />

I have the string "Description" and thus would like to perform the following, but how do I find the index of the CheckMenuItem within CycBtn that has a value of "Description".

App.CycBtn.setActiveItem(1, true);

A second related question: What is the best way to reference the value from the first menuitem in the CycleButton. The following works, but it is not pretty.


Oct 16, 2014, 7:41 PM
Hi Chris,

1. I can suggest this.

var item = App.CycBtn.menu.child(Ext.String.format("[text={0}]", "Description"))

2. I can suggest this.


Well, not pretty still, but more correct, I think. If the text is changed on the fly, it won't appear in the initialConfig.

Oct 17, 2014, 3:33 PM
Please close the thread. Great information, thanks.