Home > Web Front-end > JS Tutorial > body text

Discussion of several methods of Extjs_extjs

WBOY
Release: 2016-05-16 18:35:37
Original
1161 people have browsed it

I believe everyone has used code similar to the following when developing Extjs: >
var form_pz = new Ext.form.FormPanel({

id: "form_pz", region: "center", labelAlign: "right", lazyRender: true, frame: true, items: [{ xtype: "combo",
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);
var value = record.get("ID"); Ext.getCmp("CPMC").setValue(value); The above is the main program. After running like this, the drop-down box will not be automatically selected. However, take out the Store separately and define it:


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.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!