2012-04-16 53 views
0

iam使用Ext.form.combobx執行自動完成搜索,我的數據存儲在數組存儲中:ext.data.arraystore,實際上數組存儲中的數據被加載通過Ajax請求,這是我arraystore代碼:combobx不顯示來自ext.data.arraystore的數據

var ds = new Ext.data.ArrayStore({ 
    fields: ['description','lat','lng'], 
    data: xmlarray 
}); 

其中xmlarray是從PHP服務器使用AJAX請求

這裏加載的數據陣列是我combobx代碼:

var timePanel = { 
     xtype: 'panel', 
     border: false, 
     width: 600, 
     bodyPadding: 10, 
     layout: 'anchor', 

     items: [{ 
     xtype:'combo' , 
     displayField:'displayValue', 
     valueField: 'id', 
     store: ds, 
     mode: 'local', 
     typeAhead: true, 
     triggerAction: 'all', 
     hideTrigger:false, 
     lazyRender: true, 
     emptyText: 'select a city', 
     forceSelection: false, 
     typeAhead: true, 
     selectOnFocus: true, 
     enableKeyEvents:true, 

     listConfig: { 
      loadingText: 'Searching...', 
      emptyText: 'No matching posts found.', 

      // Custom rendering template for each item 
      getInnerTpl: function() { 
       return '<div class="search-item">' + 
        '<h3><span>{[Ext.Date.format(values.lastPost, "M j, Y")]}<br />by {author}</span>{title}</h3>' + 
        '{excerpt}' + 
       '</div>'; 
      } 
     }, 
      pageSize: 10, 
      //listeners: {select: this.GeocoderRequest}; 

      } 

      ] 
    }; 

我的主要問題是,組合框顯示我一組空選擇行,而每個選擇行應顯示從我的數據名稱,但它的空而是..在我的arrastore或組合框配置中有任何問題?

回答

1
fields: ['description','lat','lng'], 

... 

displayField:'displayValue', 
valueField: 'id', 

有沒有現場的商店名爲displayValue,因此組合框無法找到它正在尋找的值。 valueField也一樣。

+0

非常感謝你..這是事情....但我的組合框不會執行任何自動完成搜索right.it只是顯示數據,因爲它是,我讀了關於配置自動完成combobx和我認爲我目前的配置應該做到這一點..有什麼缺少? – 2012-04-16 11:19:36