-
5 Sep 2011 7:26 AM #1
Cyclebutton stops working after I add a menu Item?
Cyclebutton stops working after I add a menu Item?
When I add menu Items to cycleButton it seems to break the cycle button and I cannot select the newly added buttons...
I had a look here and tried to insert the extra params but it had no effect?
http://www.sencha.com/forum/showthre...ht=cyclebutton
What silly thing have I done to break it?
Code:var vTotalYear = vCurrentYear - 2009; var vComponentName = ['btnFiscalYearFrom','btnFiscalYearTo']; for (i=0;i<vComponentName.length;i++){ var vYearsToDisplay = []; var component = Ext.getCmp(vComponentName[i]); for (x = 0;x<=vTotalYear;x++) { var vYear = 2009 + x; var vYearVal; if (vYear == vCurrentYear) { vYearVal = { id:'active_'+vComponentName, text:vYear, xtype:'menuitem', checked:true }; } else { vYearVal = { text:vYear, xtype:'menuitem' }; } vYearsToDisplay[x]=vYearVal; } component.menu.add(vYearsToDisplay); component.setActiveItem('active_'+vComponentName); }
-
6 Sep 2011 5:22 AM #2
ok fixed the menu so it's selectable updating -
xtype: 'menucheckitem',
But cycles still not workingCode:xtype: 'menucheckitem', checkHandler: component.checkHandler, group: 'land', itemIndex: component.itemCount + (x+1), scope: component

But the drop down menu when you select an item is now selected and visible.
-
5 Oct 2012 8:34 AM #3
This is working for me in 4.1.2 if....
This is working for me in 4.1.2 if....
Hi there,
You code helped me out. I found two ways to solve this problem.
1. I found that if the cycle button is initially configured with a menu and at least one menucheckitem it wires everything up correctly. Then in my code I use the cloneConfig({text: 'my new item'); to create a new item which becomes a member of the same radio group when I call the menu.add(). Of course I'm removing the initially configured item.
2. If I follow your example but set the group: 'name of cycle button' then it works too. My guess is that the handler is using the group name to find the Cycle button above it to set the text, etc.Code:var item = cycle.menu.items.items[0].cloneConfig({text: 'cloned item'}); cycle.menu.add(item);
Code:item = Ext.create('Ext.menu.CheckItem', { text: 'James Sutton', checkHandler: cycle.checkHandler, checked: true, scope: cycle, group: 'currentUser' }); cycle.menu.add(item);


Reply With Quote