extjs组合框

时间:2011-05-06 07:59:08

标签: javascript extjs

我想知道如何在extjs组合框中我可以搜索一个值。如果我输入'a'那么必须显示以a开头的项目列表,并且项目选择器应该选择它是否与'匹配'一个'我已经尝试了很多,但没有任何相关的是我的代码:

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')
}

1 个答案:

答案 0 :(得分:0)

在组合框中尝试此操作

        typeAhead       : true
        ,mode           : 'remote'

检查一下:typeAhead For ComboBox