1. First
2. Ext code
Code
// Set the data source parameters of the ComboBox list
VaR comboxstore = new Ext. Data. Store ({
Proxy: New Ext. Data. httpproxy ({
URL: "http://www.cnblogs.com/Service/SystemService/RoleService.ashx? Method = getallroles"
}),
Reader: New Ext. Data. jsonreader ({
Root: 'table ',
Totalproperty: 'recordcount ',
ID: 'roleid ',
Fields: ['roleid', 'rolename']
})
});
Comboxstore. Load ();
// Role drop-down list
VaR rolecombox = new Ext. Form. ComboBox ({
ID: 'rcombox ',
// Xtype: 'combo ',
Fieldlabel: 'Role ',
Emptytext: 'select the role ',
Name: 'rolename ',
Anchor: '20140901 ',
Store: comboxstore,
Displayfield: 'rolename ',
Valuefield: 'roleid ',
Hiddenname: 'roleid ',
Typeahead: True,
Mode: 'remote ',
Triggeraction: 'all ',
Selectonfocus: True,
Blanktext: 'Role cannot be null ',
Allowblank: false,
Editable: false
});
3. Question about the value submitted by ComboBox in the form
There are two methods:
1. Params: {roleid: Ext. getcmp ('rcombox'). getvalue ()}
Pass getvalue () through Params to get the value in valuefield
2. Configure hiddenname to save the value in valuefield. Otherwise, the value in the name attribute will be submitted, that is, the value of dispalyfield.
4. Parameter Introduction
Mode: Data Source mode local remote indicates that data is read from the server
Selectonfocus: If the value is true, the existing text of the field is automatically selected when the field obtains the focus.
Editable: True indicates that it can be edited.