Ext JS: What is ComboBox? How to Use

Source: Internet
Author: User

What is ComboBox of Ext JS? To put it bluntly, it is the drop-down list + text, but more abundant!

How to use it?

[Javascript]
Ext. onReady (function (){
Var store = Ext. create ("Ext. data. Store ",{
Fields: ["abbr", "name"],
Data :[
{"Abbr": "wbg", "name": "wubangguo "},
{"Abbr": "wjb", "name": "wenjiabao "},
{"Abbr": "hjt", "name": "hujintao "},
{"Abbr": "lks", "name": "likeshan"}],
Sorters: ["abbr"] // sort
});
Ext. create ("Ext. form. ComboBox ",{
FieldLabel: "Choose Name ",
Store: store, // load the data source
QueryMode: "local", // if the data is local, you 'd better use this option to improve performance, the default situation is remote (note that the local option is also used when we return data to the local store through ajax requests, because if this is not the case, the server will be requested once more)
DisplayField: "name ",
ValueField: "abbr ",
ForceSelection: true, // select from the drop-down list only. text cannot be entered.
Editable: false, // editing is not allowed. The default value is true)
MultiSelect: true, // in this case, multiple items can be selected and displayed in combobox (false by default)
Listeners :{
Scope: this,
"Select": function (comboBox, record, index ){
Ext. Array. each (record, function (item ){
Alert (item. get ("name "));
});
Alert (comboBox. getValue (); // This is the value, not the value where it is displayed.
}
},
RenderTo: Ext. getBody ()
});
});

Related Article

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.