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
'
);