EXT core API details Ext. toolbar (18)

Source: Internet
Author: User

The toolbar is easy to use. Just add the prepared elements.

Method
Toolbar (Object/array config)
Structure

Add (mixed arg1, mixed arg2, mixed etc.): void
Add Element
Yes
1: Ext. toolbar. Button is equivalent to addbutton
2: htmlelement is equivalent to addelement
3: field is equivalent to addfield
4: item is equivalent to additem
5: string is equivalent to addtext
6: 'parator' or '-' is equivalent to addseparator
7: ''is equivalent to addspacer
8: '->' is equivalent to addfill

Addbutton (Object/array config): Ext. toolbar. Button/Array
Add Ext. toolbar. button/splitbutton object, because Ext. toolbar. button and ext. there is no difference in using the button, and the toolbar supports both of them. I didn't find any difference in using the button in my experiment.

Adddom (Object config): Ext. toolbar. Item
Add a DOM Node

Addelement (mixed El): Ext. toolbar. Item
Add Element Object
Addfield (ext. Form. Field field): Ext. toolbaritem
Add Ext. Form. Field object

Addfill (): Ext. toolbar. Fill
Add a blank element that fills the toolbar

Additem (ext. toolbar. item): Ext. toolbar. Item
Added to Ext. toolbar. item object

Addseparator (): Ext. toolbar. Item
Add a separator, which is equivalent to additem (New Ext. toolbar. separator ());

Addspacer (): Ext. toolbar. Spacer
Add a blank element, which is equivalent to additem (New Ext. toolbar. spacer ());

Addtext (string text): Ext. toolbar. Item
Add a text element, which is equivalent to additem (New Ext. toolbar. textitem (text ));

Insertbutton (number index, object/EXT. toolbar. Item/EXT. toolbar. Button button): Ext. toolbar. Button/item
Insert a button object before the index Element

Ext. toolbar. Item
Toolbar element base class

Toolbar. Item (htmlelement El)
Structure

Destroy (): void
Destroy

Disable (): void
Enable (): void
Available/disabled

Focus (): void
Get focus

Getel (): htmlelement
Get the current DOM object

Setvisible (Boolean visible): void
Show (): void
Hide (): void
Hide

Ext. toolbar. Separator
Inherited from item, toolbar Separator

Ext. toolbar. Spacer
Inherited from item, blank toolbar Element

Ext. toolbar. textitem
Inherited from item, toolbar text element

Ext. toolbar. Fill
Inherited from spacer, blank toolbar elements, full Toolbar

Simple Example

VaR
TB
=

New
Ext. toolbar (
...
{Width:
400
}

);

//
Render before ADD. required. Otherwise, an error is reported. // render before ADD. required.


TB. Render (ext. getbody ());



TB. addtext (
'
Select a time
'
);

TB. Add (
New
Ext. Form. datefield (
...
{
//
Datefield


Fieldlabel:
'
Datefield
'
,

Format:
'
Y-m-d
'
,

Disableddays :[
0
,
6
]

}

)

);

TB. addbutton (


New
Ext. toolbar. Button (
...
{

Text:
'
Button
'
,

Handler:
Function
(Item)
...
{

Ext. MessageBox. Alert (
"
Toolbar
"
,
"
You clicked
"
+
Item. Text)

}



}

)

);

TB. addspacer ();

TB. addseparator ();

TB. addfill ();

TB. Add (
New
Ext. splitbutton (
...
{

Handler:
Function
(Item)
...
{

Ext. MessageBox. Alert (
"
Click Event
"
, String. Format (
"
You selected {0}
"
, Item. Text ));

}

,

Arrowtooltip:
"
More
"
,

Text:
'
Press me
'
,

Menu:
New
Ext. Menu. menu (
...
{

ID:
'
Mainmenu
'
,



Items :[


...
{

Text:
'
Menu item 1
'


}

,


...
{

Text:
'
Menu item 2
'


}

]

}

)

}

)

);

TB. Add (
'
End on the right
'
);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.