PDA

View Full Version : [CLOSED] Set CycleButton Active Item in Code Behind



xtoolz
Jun 10, 2014, 8:37 AM
Good Morning

I use a Cycle Button an my Screen. Normally the Active Item is Set in JS
cmdMode.setActiveItem(0, true);
In one case the Button should be handled in Code Behind (VB.NET)...

I tried this
cmdMode.ActiveItem.Set("0", True) but that seems to be wrong :-(

Could you please tell me how to solve this Problem ?

Peter

Daniil
Jun 10, 2014, 2:47 PM
Hi Peter,

Please use

cmdMode.ActiveItemIndex = 0;

xtoolz
Jun 10, 2014, 3:29 PM
cmdMode.ActiveItemIndex = 0;

Hmm, I tried that but it causes this error :

Unable to cast object of type 'Ext.Net.MenuItem' to type 'Ext.Net.CheckMenuItem'.

Here's my mark up


<ext:CycleButton ID="cmdMode" runat="server" ShowText="true" PrependText="CRMCycleButtonText">
<Menu>
<ext:Menu ID="mnuMode" runat="server">
<Items>
<ext:MenuItem ID="mnuExternalContact" runat="server" Text="ContactExternal" Icon="UserEarth" />
<ext:MenuItem ID="mnuCompany" runat="server" Text="Company" Icon="House" />
</Items>
</ext:Menu>
</Menu>
</ext:CycleButton>

Any Idea ?

Daniil
Jun 10, 2014, 7:59 PM
I've reproduce. I think we will fix that very soon in the trunk.

Please try this for now.

cmdMode.Call("setActiveItem", 0);

Daniil
Jun 11, 2014, 7:12 AM
There is a limitation with a CycleButton. It is supposed to be working with CheckMenuItems only.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.button.Cycle

Here is a related issue - CycleButton breaks if add a non-CheckItem into its menu (https://github.com/extnet/Ext.NET/issues/286)

I fixed that a while ago.

Though, now, it is problematic to fix the ActiveTabIndex/ActiveItem issue. I think we will leave it for now as it is. Please use the suggested solution, it appears to be good enough.

I've added the thread to the Issue's description. Maybe, at some point we will revise that.

xtoolz
Jun 11, 2014, 1:23 PM
Thanks Daniil, I'll do this :-)


There is a limitation with a CycleButton. It is supposed to be working with CheckMenuItems only.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.button.Cycle

Here is a related issue - CycleButton breaks if add a non-CheckItem into its menu (https://github.com/extnet/Ext.NET/issues/286)

I fixed that a while ago.

Though, now, it is problematic to fix the ActiveTabIndex/ActiveItem issue. I think we will leave it for now as it is. Please use the suggested solution, it appears to be good enough.

I've added the thread to the Issue's description. Maybe, at some point we will revise that.