PropertiesMethodsEventsConfig OptionsDirect Link

Class Ext.Action

Defined In: Action.js
Class: Ext.Action
Extends: Object

Action 是可复用性中可以抽象出来,被任意特定组件所继承的特性之一。 Action 使你可以通过所有实现了 Actions 接口的组件共享处理函数、配置选项对象以及 UI 的更新(比如 Ext.ToolbarExt.ButtonExt.menu.Menu 组件)。

除了提供的配置选项对象接口之外,任何想要使用 Action 的组件必需提供下列方法以便在 Action 所需时调用:setText(string)、setIconCls(string)、setDisabled(boolean)、setVisible(boolean)和setHandler(function)。

使用示例:

// Define the shared action.  Each component below will have the same
// display text and icon, and will display the same message on click.
var action = new Ext.Action({
    text: 'Do something',
    handler: function(){
        Ext.Msg.alert('Click', 'You did something.');
    },
    iconCls: 'do-something'
});

var panel = new Ext.Panel({
    title: 'Actions',
    width:500,
    height:300,
    tbar: [
        // Add the action directly to a toolbar as a menu button
        action, {
            text: 'Action Menu',
            // Add the action to a menu as a text item
            menu: [action]
        }
    ],
    items: [
        // Add the action to the panel body as a standard button
        new Ext.Button(action)
    ],
    renderTo: Ext.getBody()
});

// Change the text for all components using the action
action.setText('Something else');

配置项

配置项 定义者

公告属性

属性 定义者

公共方法

方法 定义者

公告事件

这个类没公共的事件。