【问题标题】:extjs combo boxextjs 组合框
【发布时间】:2011-08-19 23:45:03
【问题描述】:

我想知道如何在 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')
}

【问题讨论】:

    标签: javascript extjs


    【解决方案1】:

    在组合框中试试这个

            typeAhead       : true
            ,mode           : 'remote'
    

    检查这个:typeAhead For ComboBox

    【讨论】:

    • 感谢您的回答,但此方法仅在列表中提前输入第一个名称....这不是我想要的
    • @suchita:请关闭您的 Caps Lock 键。
    猜你喜欢
    • 2012-01-11
    • 1970-01-01
    • 2012-10-10
    • 2012-06-29
    • 2012-06-20
    • 2011-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多