Ext.action
The action implements an event that is detached from the container, all of which can be shared among multiple containers, but it seems as if only Ext.toolbar, Ext.button and Ext.menu.Menu support the action interface: Because the container implements all of the following methods SetText (string), Seticoncls (String), Setdisabled (Boolean), SetVisible (Boolean) and SetHandler (function)
Method:
Action (Object config)
Construction, config is defined as {
disabled:boolean,//Prohibit use
handler:function,//Event Handle
hidden:boolean,//Hide
iconcls:string,//Style class
Scope:object,//handler will be executed in which range
Text:string//Text
}
Disable (): void
Enable (): void
setdisabled (Boolean disabled): void
Prohibit/allow
Each (Function FN, Object scope): void
APPLY FN For each componet that implements this action
Hide (): void
Show (): void
Sethidden (Boolean hidden): void
Show/Hide
SetHandler (Function fn, Object scope): void
Seticonclass (String cls): void
SetText (String text): void
Reset property values for config configuration
Example:
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: [
//将action做为一个菜单按钮添加到工具栏
action, ...{
text: 'Action Menu',
//将action做为文本选择项添加到menu
menu: [action]
}
],
items: [
//由action构造button,添加到panel
new Ext.Button(action)
],
renderTo: Ext.getBody()
});
// 如果这儿setText.当然button/menu/toolbar中的action文本都变了
action.setText('Something else');
Ext.button
Simple Button class
Public properties:
Disabled:boolean
Allow?
Hidden:boolean
Hide?
Pressed:boolean
Press the button?
method [inherited from Ignore]
Button (Object config)
Construct optional config{
clickevent:string,//handler response event, default is click
Cls:string,//Style
Disabled:boolean,//Forbidden
enabletoggle:boolean,//allows you to toggle between pressing and not pressing, adding remove x-btn-pressed style class
handlemouseevents:boolean,//allows you to use the move in move out press event, the default is True
Handler:function,//Responding to events defined by Clickevent
Hidden:boolean,//Hide
icon:string,//icon file address, if modified X-btn-text-icon style class can redefine default icon
Iconcls:string,//is similar to icon functionality, but uses a style definition with the Background-image attribute set
menu:mixed//If needed, you can define menus for buttons
Menualign:string,//menu alignment, default value is TL-BL
Minwidth:number,//min width
Pressed:boolean,//whether to press
repeat:boolean/object,//whether you want to repeatedly define the mouse down event, or you can be a Ext.util.ClickRepeater configuration object
Scope:object, the scope of the//handler event
Tabindex:number,//table Key order
Text:string,//text
Togglegroup:string,//If you define a set of button objects with the same enabletoggle as true and Togglegroup values, the objects will have only one pressed state at a time
Tooltip:string/object,//hint information, can be a string or Quicktips configuration object
Tooltiptype:string,//optional value "Qtip" (default) or "title" one
type:string//Optional value "submit"/"Reset"/"button" (default) One
}