2011-02-18 79 views
1

對我的組合框字段有一些問題。所有都是未定義的。所有字段在組合框中都是「未定義的」

buildMyCombo : function(label) 
{ 
    var store = new Ext.data.ArrayStore({ 
     fields: ['name', 'value'], 
     data : [ 
      ['.xls', 1], 
      ['.csv', 2], 
      ['.htm', 3] 
     ] 
    }); 

    var result = new BGGNE.components.fields.SimpleComboBox({ 
     formFields: {}, 
     enableKeyEvents: true, 
     store: store, 
     valueField: 'value', 
     displayField: 'name', 
     lazyInit:false, 
     formFieldDefinition: { 
      isMandatory: true, 
      fieldLabel: label, 
      hideTrigger: false, 
      selectOnFocus: true, 
      isEditableInDialog: false, 
      type: { 
       kind: 'local', 
       type: 'Text', 
       selectableValues: 'name' 
      }, 
      renderAsExtField: true, 
      isOnAPropagation: true, 
      forceSelection: true 
     } 
    }); 
    result.on('focus', function() 
    { 
     result.doQuery('', true); 
    }, this); 
    result.on('select', this.onComboSelect, this); 

    return result; 
}, 

所以,我應該從商店看到3件商品,而我只看到3件商品'undefined'。所以,我相信組合框會讀取商店,因爲它知道我在那裏有多少物品。但由於某些未定義的文本顯示。

+0

我懷疑此代碼爲我的問題:「類型:{ 類型:‘本地’, 類型:‘文本’, selectableValues:‘名’ },」但如果我刪除它很多的錯誤。這意味着必須有一些我錯過的配置。 – Bogdan 2011-02-18 13:58:38

回答

0

我設法自己解決問題。問題是我需要把這個代碼

store: store, 
valueField: 'value', 
displayField: 'name', 

在formFieldDefinition。雖然SimpleComboBox擴展了ComboBox,但一些代碼被覆蓋,而formFieldDefinition是定義列表項的字段。

謝謝並道歉,如果這個問題是浪費你的時間。

相關問題