简体   繁体   English

extjs组合框

[英]extjs combo box

I want to know that how in extjs combo box i can search for a value.like if i have entered 'a' then a list of items starting with a must be displayed and the item selector should select if it matches with 'a' i have tried a lot but did not got anything related here is my code: 我想知道如何在extjs组合框中搜索值。例如,如果我输入了``a'',则必须显示以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')
}

try this in combo box 在组合框中尝试一下

        typeAhead       : true
        ,mode           : 'remote'

check this : typeAhead For ComboBox 检查此: ComboBox的typeAhead

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM