2016-07-29 119 views
0

我在我的网页中有一个搜索文本字段,我想在文本字段中输入值时触发搜索。如何在Ext JS搜索字段中执行搜索

enter image description here

我使用以下代码段把值在搜索文本框中

VAR补偿= Ext.getCmp( '账户号码'); comp.setValue('2048007162');

一旦设置了值,我想触发搜索。

+0

你的“searchfield”应该使用'store'组件按输入值执行搜索。显示您的'商店'定义和'AccountNumber'组件定义 – RomanPerekhrest

回答

1
On searchbox change event you have to load the store with search query 
Example 
{ 
xtype: 'textfield', 
text: 'Search', 
emptyText: 'Search', 
listeners: { 
    'change' : function(field, value, oldvalue, eOpts) { 
      this.store.load({params:{id: 1,search: value}}); 
    }, 
    scope:this, 
} 

你必须在后端获取参数搜索,并根据你必须编写你的查询。