コード:
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);
},
私のモデルでは、4 つのフィールドがあります。
名前、年齢、性別、特徴
私がここで試しているのは次のとおりです。
ページのリストにデータベースのコンテンツを表示します。リストが長いため、検索したかったのですが、ユーザーが検索フィールドにクエリを記述して検索ボタンを押すと、searchButtonTap
ハンドラーが呼び出され、リストをフィルタリングして表示しようとしますクエリの名前に似た名前も試しfilterBy
ましたが、それも機能しませんでした。何が悪いのか教えてください。
ありがとう。