2011-05-06 181 views
1

我想知道如何在extjs組合框中搜索value.like,如果我輸入了'a',那麼必須顯示以a開頭的項目列表,並且項目選擇器應該選擇它以「」我已經嘗試了很多,但並沒有來到這裏與任何匹配是我的代碼:extjs組合框

var account_details_store = new Ext.data.Store({ 
    id:'acs_store', 
    reader: new Ext.data.JsonReader({ 
    totalProperty: 'count', 
    fields: [{ 
      name: 'accountid', 
      mapping: 'accountid' 
     }, 
     { 
      name: 'accountname', 
      mapping:'accountname' 
     }, 
     { 
      name: 'address', 
      mapping:'address' 
     }, 
     { 
      name: 'city', 
      mapping: 'city' 
     }, 
     { 
      name: 'contactnum', 
      mapping: 'contactnum' 
     }], 
     // fields: ['accountid','accountname','address','city','contactnum'], 
     root: 'rows' 
    }), 
    proxy: new Ext.data.HttpProxy({ 
     url: 'accountdetailscombo.php' 
    }), 
    autoLoad:true 
}); 
xtype: 'combo', 
fieldLabel: 'Account details', 
store:account_details_store, 
valueField: 'accountid', 
displayField:'accountname', 
forceSelection:true, 
typeAhead: false, 
loadingText: 'Searching...', 
emptyText: 'Type the first characters of the name', 
minChars: 1, 
anchor: '100%', 
pageSize: 0, 
hideTrigger:true, 
editable: true, 
triggerAction: 'all', 
width: 280, 
height:250, 
tpl: tpl, 
itemSelector: 'div.combo-result-item', 
onSelect: function(record) {   
    this.setValue(record.data.accountname); 
    this.collapse(); 
    // Ext.getCmp('acs_store') 
} 

回答

0

嘗試這種在組合框中

 typeAhead  : true 
     ,mode   : 'remote' 

檢查:typeAhead For ComboBox

+0

Thanku烏拉圭回合回答但是這個方法只有類型提前列出名字....它不是我想要的 – suchita 2011-05-08 04:28:03

+3

@suchita:請關閉您的Caps Lock鍵。 – 2011-05-11 07:26:58