blackant2
工具栏,使用起来很简单,add已准备好的元素就行
方法
Toolbar( Object/Array config )
构造
add( Mixed arg1, Mixed arg2, Mixed etc. ) : void
增加元素
可以是
1:Ext.Toolbar.Button 相当于addButton
2:HtmlElement 相当于addElement
3:Field 相当于addField
4:Item 相当于addItem
5:String 相当于addText
6:'separator'或'-' 相当于addSeparator
7:'' 相当于addSpacer
8:'->' 相当于addFill
addButton( Object/Array config ) : Ext.Toolbar.Button/Array
添加Ext.Toolbar.Button/SplitButton对象,其实因为Ext.Toolbar.Button和Ext.Button用起来没什么区别,而且Toolbar两者都支持,我实验时没发现使用上有什么不同
addDom( Object config ) : Ext.Toolbar.Item
添加DOM节点
addElement( Mixed el ) : Ext.Toolbar.Item
添加Element对象
addField( Ext.form.Field field ) : Ext.ToolbarItem
添加Ext.form.Field对象
addFill() : Ext.Toolbar.Fill
添加一个撑满工具条的空白元素
addItem( Ext.Toolbar.Item item ) : Ext.Toolbar.Item
添回Ext.Toolbar.Item对象
addSeparator() : Ext.Toolbar.Item
添加一个分隔元素,相当于addItem(new Ext.Toolbar.Separator());
addSpacer() : Ext.Toolbar.Spacer
添加一个空白元素,相当于addItem(new Ext.Toolbar.Spacer());
addText( String text ) : Ext.Toolbar.Item
添加文本元素,相当于addItem(new Ext.Toolbar.TextItem(text));
insertButton( Number index, Object/Ext.Toolbar.Item/Ext.Toolbar.Button button ) : Ext.Toolbar.Button/Item
在第index个元素之前插入button对象
Ext.Toolbar.Item
工具栏元素基类
Toolbar.Item( HTMLElement el )
构造
destroy() : void
销毁
disable() : void
enable() : void
可用/禁用
focus() : void
得到焦点
getEl() : HTMLElement
得到当前DOM对象
setVisible( Boolean visible ) : void
show() : void
hide() : void
显示隐藏
Ext.Toolbar.Separator
继承自item,工具栏分隔符
Ext.Toolbar.Spacer
继承自item,工具栏空白元素
Ext.Toolbar.TextItem
继承自item,工具栏文本元素
Ext.Toolbar.Fill
继承自Spacer,工具栏空白元素,撑满工具栏
简单的示例
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_25_35_Open_Image" onclick="this.style.display='none'; document.getElementById('_25_35_Open_Text').style.display='none'; document.getElementById('_25_35_Closed_Image').style.display='inline'; document.getElementById('_25_35_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top">
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_25_35_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('_25_35_Closed_Text').style.display='none'; document.getElementById('_25_35_Open_Image').style.display='inline'; document.getElementById('_25_35_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top">
var tb = new Ext.Toolbar(...{width:400});
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">//在add之前先render,必要,不然会报错//在add之前先render,必要
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">tb.render(Ext.getBody());
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">tb.addText('请选择时间');
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_162_251_Open_Image" onclick="this.style.display='none'; document.getElementById('_162_251_Open_Text').style.display='none'; document.getElementById('_162_251_Closed_Image').style.display='inline'; document.getElementById('_162_251_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top">0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_162_251_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('_162_251_Closed_Text').style.display='none'; document.getElementById('_162_251_Open_Image').style.display='inline'; document.getElementById('_162_251_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top">tb.add( new Ext.form.DateField(...{ //DateField
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> fieldLabel:'DateField',
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> format:'Y-m-d',
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> disabledDays:[0,6]
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top"> })
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">);
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">tb.addButton(
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_298_414_Open_Image" onclick="this.style.display='none'; document.getElementById('_298_414_Open_Text').style.display='none'; document.getElementById('_298_414_Closed_Image').style.display='inline'; document.getElementById('_298_414_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top">0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_298_414_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('_298_414_Closed_Text').style.display='none'; document.getElementById('_298_414_Open_Image').style.display='inline'; document.getElementById('_298_414_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top"> new Ext.Toolbar.Button(...{
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> text:'button',
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_345_408_Open_Image" onclick="this.style.display='none'; document.getElementById('_345_408_Open_Text').style.display='none'; document.getElementById('_345_408_Closed_Image').style.display='inline'; document.getElementById('_345_408_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top">0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_345_408_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('_345_408_Closed_Text').style.display='none'; document.getElementById('_345_408_Open_Image').style.display='inline'; document.getElementById('_345_408_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top"> handler:function(item)...{
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> Ext.MessageBox.alert("toolbar","您点击了"+item.text)
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"> }
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top"> })
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">);
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">tb.addSpacer();
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">tb.addSeparator();
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">tb.addFill();
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_496_832_Open_Image" onclick="this.style.display='none'; document.getElementById('_496_832_Open_Text').style.display='none'; document.getElementById('_496_832_Closed_Image').style.display='inline'; document.getElementById('_496_832_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top">0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_496_832_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('_496_832_Closed_Text').style.display='none'; document.getElementById('_496_832_Open_Image').style.display='inline'; document.getElementById('_496_832_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top">tb.add(new Ext.SplitButton(...{
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_525_608_Open_Image" onclick="this.style.display='none'; document.getElementById('_525_608_Open_Text').style.display='none'; document.getElementById('_525_608_Closed_Image').style.display='inline'; document.getElementById('_525_608_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top">0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_525_608_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('_525_608_Closed_Text').style.display='none'; document.getElementById('_525_608_Open_Image').style.display='inline'; document.getElementById('_525_608_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top"> handler: function(item)...{
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> Ext.MessageBox.alert("点击事件",String.format("您选择了{0}",item.text));
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"> },
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> arrowTooltip : "更多",
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> text:'按我',
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_678_825_Open_Image" onclick="this.style.display='none'; document.getElementById('_678_825_Open_Text').style.display='none'; document.getElementById('_678_825_Closed_Image').style.display='inline'; document.getElementById('_678_825_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top">0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_678_825_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('_678_825_Closed_Text').style.display='none'; document.getElementById('_678_825_Open_Image').style.display='inline'; document.getElementById('_678_825_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top"> menu:new Ext.menu.Menu(...{
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> id: 'mainMenu',
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top">
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> items: [
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_737_772_Open_Image" onclick="this.style.display='none'; document.getElementById('_737_772_Open_Text').style.display='none'; document.getElementById('_737_772_Closed_Image').style.display='inline'; document.getElementById('_737_772_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top">0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_737_772_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('_737_772_Closed_Text').style.display='none'; document.getElementById('_737_772_Open_Image').style.display='inline'; document.getElementById('_737_772_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top"> ...{
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> text: '菜单项1'
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"> },
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_783_818_Open_Image" onclick="this.style.display='none'; document.getElementById('_783_818_Open_Text').style.display='none'; document.getElementById('_783_818_Closed_Image').style.display='inline'; document.getElementById('_783_818_Closed_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" align="top">0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" id="_783_818_Closed_Image" style="display: none;" onclick="this.style.display='none'; document.getElementById('_783_818_Closed_Text').style.display='none'; document.getElementById('_783_818_Open_Image').style.display='inline'; document.getElementById('_783_818_Open_Text').style.display='inline';" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" align="top"> ...{
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top"> text: '菜单项2'
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"> }]
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"> })
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top"> })
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">);
0 && image.height>0){if(image.width>=510){this.width=510;this.height=image.height*510/image.width;}}" alt="" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" align="top">tb.add('右边结束');
posted on 2007-12-07 11:41
阿门119 阅读(915)
评论(0) 编辑 收藏 引用 网摘 所属分类:
Ext