我將搜索圖標添加到了我的選項卡面板,該面板的導航視圖包含工具欄停靠的頂部的搜索字段。我的問題是我想從搜索字段中取值並將其發送到商店以查找匹配..如果有任何匹配,我希望這些項目將顯示在searchfield工具欄下方的列表中。我做了很多搜索,但我無法找到任何有助於我的相關示例。任何形式的幫助,將不勝感激。獲取搜索字段的值,然後顯示匹配結果sencha touch 2
這是我的看法..
items: [{
xtype: 'toolbar',
docked: 'top',
style: 'background:darkgray',
items: [{
xtype: 'searchfield',
placeHolder: 'Search... '
}, {
xtype: 'button',
iconCls: 'search',
iconMask: true,
ui: 'confirm',
action: 'search-app'
}]
}, {//here I want to show my filtered data
xtype: 'list',
itemId: 'searchlist',
store: 'SearchItemStore',
onItemDisclosure: true,
emptyText: 'No data found!',
itemTpl: '{Name}'
}]
在我的控制,我呼籲按鈕,添加功能是這樣的:
mySearchFunction: function(element , e, eOpts) {
var searchPattern = this.getSearchFieldAction().getValue();
var store = Ext.getStore('ProductStore');
// here I want to set the param that has to send to the store proxy..I am really not sure how this works
store.find(fieldName, value, [startIndex], [anyMatch], [caseSensitive], [exactMatch]);
}
您使用的是MVC嗎?如果是這樣,你如何控制搜索按鈕被點擊時發生的情況? – kevhender