欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Extjs 幾個(gè)方法的討論

 更新時(shí)間:2010年01月28日 22:58:33   作者:  
下面我講一下在使用Extjs遇到的一個(gè)問題,希望各位朋友看到這篇隨筆以后,能給我指教,這里我先謝過了!
相信大家在做Extjs開發(fā)的時(shí)候都使用過類似下面的代碼:        
復(fù)制代碼 代碼如下:

var form_pz = new Ext.form.FormPanel({
id: "form_pz",
region: "center",
labelAlign: "right",
lazyRender: true,
frame: true,
items: [{
xtype: "combo",
fieldLabel: "產(chǎn)品名稱",
id: "CPMC",
allowBlank: false,
store: new Ext.data.SimpleStore({//store的定義}),
displayField: "CPMC_BBH",
valueField: "ID",
anchor: "100%",
mode: "local",
triggerAction: "all",
readOnly: true,
typeAhead: true,
      }]
      });
      var data = [];//里面定義任意數(shù)據(jù)
      Ext.getCmp("Store_id").load(data);

    此時(shí)對(duì)這個(gè)下拉框以下操作的時(shí)候,即讓它默認(rèn)選中Store中第一行數(shù)據(jù):
復(fù)制代碼 代碼如下:

     var record= Ext.getCmp("CPMC").getStore().getAt(0);
     var value = record.get("ID");
     Ext.getCmp("CPMC").setValue(value);

    以上是主要程序,這樣運(yùn)行以后,下拉框是不會(huì)自動(dòng)選中的,
然而把Store單獨(dú)拿出來定義:
復(fù)制代碼 代碼如下:

    var Strore_CPMC = new Ext.data.SimpleStore({//定義});
    Strore_CPMC.load(data);
    var record= Ext.getCmp("CPMC").getStore().getAt(0);
     var value = record.get("ID");
    Ext.getCmp("CPMC").setValue(value);

    下拉框就會(huì)自動(dòng)選擇store中的第一行數(shù)據(jù),其實(shí)在其他的方法也存在類似的問題,不知道這是什么原因。望各位朋友指教。

相關(guān)文章

最新評(píng)論