Package: | Ext.menu |
Class: | ColorMenu |
Extends: | Menu |
Defined In: | ColorMenu.js |
属性 | 定义对象 | |
---|---|---|
palette : ColorPalette | ColorMenu | |
The Ext.ColorPalette instance for this ColorMenu |
方法 | 定义对象 | |
---|---|---|
ColorMenu(Object config ) |
ColorMenu | |
Creates a new ColorMenu | ||
add(Mixed args ) : Ext.menu.Item |
Menu | |
Addds one or more items of any type supported by the Menu class, or that can be converted into menu items. Any of the... | ||
addElement(String/HTMLElement/Ext.Element el ) : Ext.menu.Item |
Menu | |
Adds an Ext.Element object to the menu | ||
addEvents(Object object ) : void |
Observable | |
将对象中没有的事件从给出的对象中复制过来。 | ||
addItem(Ext.menu.Item item ) : Ext.menu.Item |
Menu | |
Adds an existing object based on Ext.menu.Item to the menu | ||
addListener(String eventName , Function handler , [Object scope ], [Object options ]) : void |
Observable | |
为该组件加入事件处理器函数 | ||
addMenuItem(Object config ) : Ext.menu.Item |
Menu | |
Creates a new Ext.menu.Item based an the supplied config object and adds it to the menu | ||
addSeparator() : Ext.menu.Item | Menu | |
Adds a separator bar to the menu | ||
addText(String text ) : Ext.menu.Item |
Menu | |
Creates a new Ext.menu.TextItem with the supplied text and adds it to the menu | ||
fireEvent(String eventName , Object... args ) : Boolean |
Observable | |
触发指定的事件, 并将参数传入(至少要有事件名称)。 | ||
getEl() : Ext.Element | Menu | |
Returns this menu's underlying Ext.Element object | ||
hasListener(String eventName ) : Boolean |
Observable | |
检查该对象是否拥有指定事件的侦听器 | ||
hide([Boolean deep ]) : void |
Menu | |
Hides this menu and optionally all parent menus | ||
insert(Number index , Ext.menu.Item item ) : Ext.menu.Item |
Menu | |
Inserts an existing object based on Ext.menu.Item to the menu at a specified index | ||
isVisible() : void | Menu | |
Read-only. Returns true if the menu is currently displayed, else false. | ||
on(String eventName , Function handler , [Object options ]) : void |
Observable | |
为该组件加入事件处理器函数, addListener 的简写方式 | ||
purgeListeners() : void | Observable | |
从对象身上移除所有的侦听器 | ||
remove(Ext.menu.Item item ) : void |
Menu | |
Removes an Ext.menu.Item from the menu and destroys the object | ||
removeAll() : void | Menu | |
Removes and destroys all items in the menu | ||
removeListener(String eventName , Function handler , [Object scope ]) : void |
Observable | |
移除侦听器 | ||
show(String/HTMLElement/Ext.Element element , [String position ], [Ext.menu.Menu parentMenu ]) : void |
Menu | |
Displays this menu relative to another element | ||
showAt(Array xyPosition , [Ext.menu.Menu parentMenu ]) : void |
Menu | |
Displays this menu at a specific xy position | ||
un(String eventName , Function handler , [Object scope ]) : void |
Observable | |
移除侦听器, removeListener 的简写方式 |
事件 | 定义对象 | |
---|---|---|
beforehide : (Ext.menu.Menu this ) |
Menu | |
Fires before this menu is hidden | ||
beforeshow : (Ext.menu.Menu this ) |
Menu | |
Fires before this menu is displayed | ||
click : (Ext.menu.Menu this , String menuItemId , Ext.EventObject e ) |
Menu | |
Fires when this menu is clicked (or when the enter key is pressed while it is active) | ||
hide : (Ext.menu.Menu this ) |
Menu | |
Fires after this menu is hidden | ||
itemclick : (Ext.menu.BaseItem baseItem , Ext.EventObject e ) |
Menu | |
Fires when a menu item contained in this menu is clicked | ||
mouseout : (Ext.menu.Menu this , Ext.EventObject e , String menuItemId ) |
Menu | |
Fires when the mouse exits this menu | ||
mouseover : (Ext.menu.Menu this , Ext.EventObject e , String menuItemId ) |
Menu | |
Fires when the mouse is hovering over this menu | ||
select : (ColorPalette palette , String color ) |
ColorMenu | |
show : (Ext.menu.Menu this ) |
Menu | |
Fires after this menu is displayed |
设置选项 | 定义对象 | |
---|---|---|
allowOtherMenus : Boolean | Menu | |
True to allow multiple menus to be displayed at the same time (defaults to false) | ||
defaultAlign : String | Menu | |
The default {@link Ext.Element#alignTo) anchor position value for this menu relative to its element of origin (defaul... | ||
minWidth : Number | Menu | |
The minimum width of the menu in pixels (defaults to 120) | ||
shadow : Boolean/String | Menu | |
True or "sides" for the default effect, "frame" for 4-way shadow, and "drop" for bottom-right shadow (defaults to "si... | ||
subMenuAlign : String | Menu | |
The {@link Ext.Element#alignTo) anchor position value to use for submenus of this menu (defaults to "tl-tr?") |
public ColorPalette palette
public function ColorMenu(Object config
)
config
: Objectpublic function add(Mixed args
)
// Create the menu
var menu = new Ext.menu.Menu();
// Create a menu item to add by reference
var menuItem = new Ext.menu.Item({ text: 'New Item!' });
// Add a bunch of items at once using different methods.
// Only the last item added will be returned.
var item = menu.add(
menuItem, // add existing item by ref
'Dynamic Item', // new TextItem
'-', // new separator
{ text: 'Config Item' } // new item by config
);
args
: MixedExt.menu.Item
public function addElement(String/HTMLElement/Ext.Element el
)
el
: String/HTMLElement/Ext.ElementExt.menu.Item
public function addEvents(Object object
)
object
: Objectvoid
public function addItem(Ext.menu.Item item
)
item
: Ext.menu.ItemExt.menu.Item
public function addListener(String eventName
, Function handler
, [Object scope
], [Object options
])
eventName
: Stringhandler
: Functionscope
: Objectoptions
: Object
组合选项
使用选项参数可以组合不同类型的监听器:
下面是一个标准的、延迟执行的、一次性的监听器,将会自动停止事件并传递一个自定义的参数(forumId)
el.on('click', this.onClick, this, { single: true, delay: 100, stopEvent : true, forumId: 4 });
这个方法也允许传递的单个参数是一个包含多个指定处理函数的设置对象。
一次调用多个处理函数
代码:
el.on({ 'click' : { fn: this.onClick scope: this, delay: 100 }, 'mouseover' : { fn: this.onMouseOver scope: this }, 'mouseout' : { fn: this.onMouseOut scope: this } });
或者简写为:
代码:
el.on({ 'click' : this.onClick, 'mouseover' : this.onMouseOver, 'mouseout' : this.onMouseOut scope: this });
void
public function addMenuItem(Object config
)
config
: ObjectExt.menu.Item
public function addSeparator()
Ext.menu.Item
public function addText(String text
)
text
: StringExt.menu.Item
public function fireEvent(String eventName
, Object... args
)
eventName
: Stringargs
: Object...Boolean
public function getEl()
Ext.Element
public function hasListener(String eventName
)
eventName
: StringBoolean
public function hide([Boolean deep
])
deep
: Booleanvoid
public function insert(Number index
, Ext.menu.Item item
)
index
: Numberitem
: Ext.menu.ItemExt.menu.Item
public function isVisible()
void
public function on(String eventName
, Function handler
, [Object options
])
eventName
: Stringhandler
: Functionoptions
: Objectvoid
public function purgeListeners()
void
public function remove(Ext.menu.Item item
)
item
: Ext.menu.Itemvoid
public function removeAll()
void
public function removeListener(String eventName
, Function handler
, [Object scope
])
eventName
: Stringhandler
: Functionscope
: Objectvoid
public function show(String/HTMLElement/Ext.Element element
, [String position
], [Ext.menu.Menu parentMenu
])
element
: String/HTMLElement/Ext.Elementposition
: StringparentMenu
: Ext.menu.Menuvoid
public function showAt(Array xyPosition
, [Ext.menu.Menu parentMenu
])
xyPosition
: ArrayparentMenu
: Ext.menu.Menuvoid
public function un(String eventName
, Function handler
, [Object scope
])
eventName
: Stringhandler
: Functionscope
: Objectvoid
public event beforehide
this
: Ext.menu.Menupublic event beforeshow
this
: Ext.menu.Menupublic event click
this
: Ext.menu.MenumenuItemId
: Stringe
: Ext.EventObjectpublic event hide
this
: Ext.menu.Menupublic event itemclick
baseItem
: Ext.menu.BaseIteme
: Ext.EventObjectpublic event mouseout
this
: Ext.menu.Menue
: Ext.EventObjectmenuItemId
: Stringpublic event mouseover
this
: Ext.menu.Menue
: Ext.EventObjectmenuItemId
: Stringpublic event select
palette
: ColorPalettecolor
: Stringpublic event show
this
: Ext.menu.MenuallowOtherMenus : Boolean
defaultAlign : String
minWidth : Number
shadow : Boolean/String
subMenuAlign : String