I believe everyone has used code similar to the following when developing Extjs: >
var form_pz = new Ext.form.FormPanel({
fieldLabel: "Product Name",
id: "CPMC",
allowBlank: false,
store: new Ext.data.SimpleStore({//store definition}),
displayField: "CPMC_BBH",
valueField: "ID",
anchor: "100%",
mode: "local",
triggerAction: "all",
readOnly: true,
typeAhead: true,
}]
});
var data = [];/ / Define any data in it
Ext.getCmp("Store_id").load(data);
At this time, when you perform the following operations on this drop-down box, it will be selected by default in the Store. One line of data:
Copy code
The code is as follows:
var record= Ext.getCmp(" CPMC").getStore().getAt(0);
Copy code
The code is as follows:
var Strore_CPMC = new Ext.data.SimpleStore({//definition});
Store_CPMC.load(data);
var record= Ext.getCmp("CPMC").getStore().getAt(0); var value = record.get("ID"); Ext.getCmp("CPMC").setValue (value); The drop-down box will automatically select the first row of data in the store. In fact, there are similar problems in other methods. I don’t know the reason for this. I hope my friends can give me some advice.