Class Ext.Action
|
Package:
|
Ext.grid
|
|
Defined In:
|
.js
|
|
Class:
|
|
|
Extends:
|
Object
|
An Action is a piece of reusable functionality that can be abstracted out of any particular component so that it
can be usefully shared among multiple components. Actions let you share handlers, configuration options and UI
updates across any components that support the Action interface (primarily Ext.Toolbar, Ext.Button
and Ext.menu.Menu components).
Aside from supporting the config object interface, any component that needs to use Actions must also support
the following method list, as these will be called as needed by the Action class: setText(string), setIconCls(string),
setDisabled(boolean), setVisible(boolean) and setHandler(function).
Example usage:
// 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');
配置项
这个类没有配置项。
公告属性
|
属性
|
定义者
|
|
|
isDisabled:
Returns true if the components usin...
Returns true if the components using this action are currently disabled, else returns false. Read-only.
|
Action
|
|
|
isHidden:
Returns true if the components usin...
Returns true if the components using this action are currently hidden, else returns false. Read-only.
|
Action
|
公共方法
| |
setText
(
String text
)
Sets the text to be displayed by al...
Sets the text to be displayed by all components using this action.
参数项:
text : String
The text to display
返回:
|
Action
|
| |
getText
(
)
Gets the text currently displayed b...
Gets the text currently displayed by all components using this action.
|
Action
|
| |
setIconClass
(
String cls
)
Sets the icon CSS class for all com...
Sets the icon CSS class for all components using this action. The class should supply
a background image that will be used as the icon image.
|
Action
|
| |
getIconClass
(
)
Gets the icon CSS class currently u...
Gets the icon CSS class currently used by all components using this action.
|
Action
|
| |
setDisabled
(
Boolean disabled
)
Sets the disabled state of all comp...
Sets the disabled state of all components using this action. Shortcut method
for {@link #enable} and {@link #disable}.
|
Action
|
| |
enable
(
)
Enables all components using this a...
Enables all components using this action.
|
Action
|
| |
disable
(
)
Disables all components using this ...
Disables all components using this action.
|
Action
|
| |
setHidden
(
Boolean hidden
)
Sets the hidden state of all compon...
Sets the hidden state of all components using this action. Shortcut method
for {@link #hide} and {@link #show}.
|
Action
|
| |
show
(
)
Shows all components using this act...
Shows all components using this action.
|
Action
|
| |
hide
(
)
Hides all components using this act...
Hides all components using this action.
|
Action
|
| |
setHandler
(
Function fn,
Object scope
)
Sets the function that will be call...
Sets the function that will be called by each component using this action when its primary event is triggered.
will be called with no arguments.
|
Action
|
| |
each
(
Function fn,
Object scope
)
Executes the specified function onc...
Executes the specified function once for each component currently tied to this action. The function passed
in should accept a single argument that will be an object that supports the basic Action config/method interface.
|
Action
|
公告事件
这个类没公共的事件。