var p_years = new Ext.form.ComboBox( {
fieldLabel : 'statistical year',
anchor : anchor_w,
mode : 'remote',
maxHeight:100,
triggerAction : 'all',
selectOnFocus : true,
forceSelection : true,
editable : false,
//store :[['11', '2011'], ['12', '2012'],['13', '2013']] //This The first type
store:[2011,2012,2013,2014,2015,2016,2017,2018] //This is the second type. When value and text are not specified, the default submission value and display value are The same.
});
In this component, you can directly write the array format [[' value','Text '],[ ],[ ]] to construct and submit the value. is the former, and the latter is used as the display value.
The following is a more formal usage, synchronizing the data dictionary from the database to render the comboBox component
var proj_main_store = new Ext.data.JsonStore({
url : "************",
fields : ['TEXT', 'VALUE'] ,
root : "objs",
baseParams : {
"obj/dicttypeid" : "BM_IMPORTANT_PROJ"
}
});
proj_main_store.addListener("load", function (){
proj_main_store.insert(0, new Ext.data.Record({
'TEXT' : 'All',
'VALUE' : ""
}));
});
var proj_main_type = new Ext.form.ComboBox( {
fieldLabel : 'Key Project',
anchor : anchor_w,
mode : 'remote',
triggerAction : 'all ',
selectOnFocus : true,
forceSelection : true,
editable : false,
valueField : 'VALUE',
displayField : 'TEXT',
store : proj_main_store
});