Clear Up
SharpKit Reference

Cycle Class

A specialized SplitButton that contains a menu of Ext.menu.CheckItem elements. The button automatically cycles through each menu item on click, raising the button's change event (or calling the button's changeHandler function, if supplied) for the active menu item. Clicking on the arrow section of the button displays the dropdown menu just like a normal SplitButton. Example usage:

  
    Ext.create('Ext.button.Cycle', {
            showText: true,
            prependText: 'View as ',
            renderTo: Ext.getBody(),
            menu: {
            id: 'view-type-menu',
            items: [{
            text: 'text only',
            iconCls: 'view-text',
            checked: true
            },{
            text: 'HTML',
            iconCls: 'view-html'
            }]
            },
            changeHandler: function(cycleBtn, activeItem) {
            Ext.Msg.alert('Change View', activeItem.text);
            }
            });
            

Namespace: Ext.button

Constructors

Fields

Name Description
changeHandler A callback function that will be invoked each time the active menu item in the button's menu has changed. If this callback is not supplied, the SplitButton will instead fire the change event on active item change. The changeHandler function will be called with the following argument list: (SplitButton this, Ext.menu.CheckItem item)
forceIcon A css class which sets an image to be used as the static icon for this button. This icon will always be displayed regardless of which item is selected in the dropdown list. This overrides the default behavior of changing the button's icon to match the selected item's icon on change.
items An array of Ext.menu.CheckItem config objects to be used when creating the button's menu items (e.g., {text:'Foo', iconCls:'foo-icon'})

This cfg has been deprecated

4.0 Use the menu config instead. All menu items will be created as CheckItems.

prependText A static string to prepend before the active item's text when displayed as the button's text (only applies when showText = true). Defaults to: ""
showText True to display the active item's text as the button text. The Button will show its configured text if this config is omitted. Defaults to: false

Methods

Name Description
getActiveItem() Gets the currently active menu item.
setActiveItem(CheckItem, object) Sets the button's active menu item.
toggleSelected() This is normally called internally on button click, but can be called externally to advance the button's active item programmatically to the next one in the menu. If the current item is the last one in the menu the active item will be set to the first item in the menu.
© Copyright 2005-2011 SharpKit. All rights reserved.