[Reprinted] ext core API details Ext. toolbar (18th)

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

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.