ExtJS drop-down list (ii)

Source: Internet
Author: User

Recently looked at ExtJS, before on this aspect did not study, only therefore did not study, heard others said this frame to occupy the memory, recently spent a few days in the study this, feels good. If it is done simply, construction with Easyui

       var st1 = new Ext.data.Store ({fields: ["Name", "id"], data: [{n        Ame: "Male", ID: "1"}, {name: "female", ID: "2"}]});                var w = new Ext.window ({height:500, width:500, Title: "Drop-down list control", Items: [ {xtype: "ComboBox", Store:st1, Displayfield: "Name                    ",//display is name Valuefield:" id ",//value is ID Fieldlabel:" Gender ",//label labelwidth:50,//label width editable:false,//non-editable empt Ytext: "Please select ...",//is empty when the text ID is displayed: "Cbosex",//id listeners: {/ /listen events, except for click events, all other events are written here Select:function (c, b) {//Select event alert (ext.getc MP ("Cbosex"). GetValue ());        I got the ID here.                }                    }                }            ]        }); W.show ();


var combo = new Ext.form.ComboBox ({            emptytext: ' Please select Shanxi City ',            mode: ' Local ',            width:100,            triggeraction: ' All ',            transform: ' Combo '        });        var btn = new Ext.button ({            text: "list box value",            renderTo:Ext.getBody (),            handler:function () {                Ext.Msg.alert ("City", "Actual value:" + combo.getvalue () + "; Display value:" + combo.getrawvalue ());            }        );

     <select id= "combo" class= "center" >            <option value= "Dalian" > Taiyuan </option>            <option value= " Shenyang "> Jincheng </option>            <option value=" Dandong "> Changzhi </option>            <option value=" Anshan " > Linfen </option>        </select>  

There are bad places to write, you can always put forward, learn more.

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.