我将搜索图标添加到了我的选项卡面板,该面板的导航视图包含工具栏停靠的顶部的搜索字段。我的问题是我想从搜索字段中取值并将其发送到商店以查找匹配..如果有任何匹配,我希望这些项目将显示在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