Ext.net Study notes 10:ext.net combobox usage

Source: Internet
Author: User

A ComboBox is one of the most common controls, much like the Select control in HTML, but can be multi-selected, custom display format, paging, and so on. ComboBox usage
<Ext:ComboBoxRunat= "Server"Id= "Cmbuserlist"Displayfield= "Name"Valuefield= "ID" > <Store> <Ext:StoreRunat= "Server"Id= "Storeuserinfo" > <Model> <Ext:ModelId= "Model1"Runat= "Server"Idproperty= "ID" > <Fields> <Ext:ModelfieldName= "ID"Type= "Int" ></Ext:Modelfield> <Ext:ModelfieldName= "Name"Type= "String" ></Ext:Modelfield> <Ext:ModelfieldName= "Gender"Type= "String" ></Ext:Modelfield> <Ext:ModelfieldName= "Age"type= "Int" ></ext:modelfield> </ Fields> </ext:model> </model> </ext:Store> </></ Ext:combobox>   

For a ComboBox, be sure to make Displayfield and Valuefield, then it contains a store, this store we are not unfamiliar, the previous few have been used.

Then we bind the data to the store when the page loads:

Bindstore () {    UserInfo. GetData ();    Storeuserinfo.databind ();} 

The example of such a simple ComboBox is complete.

ComboBox Sub-page

When the amount of data is large, of course we want to be able to display the page, this feature ComboBox is supported.

First we need to page the store, the previous Ext.net study Note 08: The use of data and ext.net learning notes 09:ext.net in the usage of the store has been introduced, here is no longer discussed.

We then add the PageSize attribute of the paging to the definition of the ComboBox:

<ext:runatIDdisplayfieldvaluefieldPageSize= "5" >    

Refresh our page again and you will find that the ComboBox is already supported for paging.

ComboBox Custom Display

The ComboBox supports customizing the display of each item through Xtemplate.

<Ext:ComboBoxRunat= "Server"Id= "Cmbuserlist"Displayfield= "Name"Valuefield= "ID"Matchfieldwidth= "false"PageSize= "5" > <Store>...</Store><Listconfig> <ItemtplRunat= "Server" > <Html> <Div> <B>{Name}</B><Br/> <Span>Ages: {Age}</span><br  /> <> gender: { Gender}</span  > </div   > </itemtpl  > </  ></ext:ComboBox< Span style= "color:blue;" >>                 

Ext.net Learning Note 10:ext.net ComboBox usage

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.