【发布时间】: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