代码:
this.searchField = new Ext.form.Text({
displayField: 'name',
valueField: 'name',
editable: true,
forceSelection: true,
triggerAction: 'all',
emptyText: 'Search...',
selectOnFocus: true
});
this.searchButton = new Ext.Button({// The button press will invoke the search action
text: 'Go',
handler: this.searchButtonTap,
scope: this
});
this.topToolbar = new Ext.Toolbar({
items: [
{ xtype: 'spacer' },
this.searchField,
this.searchButton,
{ xtype: 'spacer' },
]
});
searchButtonTap: function () {
var searchText = this.searchField.getValue();
console.log(searchText);
//console.log(this.myappsList.store.getCount());
console.log(this.myappsList.store.filter('name', searchText));
//this.myappsList.store.filter(searchText);
},
在我的模型中,我有四个字段:
姓名、年龄、性别、特征
我在这里尝试的是:
在页面上的列表中显示我的数据库的内容,因为列表很长,我想搜索,当用户在搜索字段中写入查询并按下搜索按钮时,将searchButtonTap
调用处理程序尝试过滤并显示列表与查询中的名称相似的名称我也尝试过filterBy
,但这也不起作用。请让我知道有什么问题吗?
谢谢。