Sencha touch 如何搜索嵌套列表
我正在尝试向嵌套列表添加搜索栏。 添加了搜索栏,当我使用console.log尝试它时,它可以正常工作 它会找到我正在查找的记录,但我不知道如何“刷新”嵌套列表以仅显示搜索结果。如果我使用“mystore.load()”,它会将我带回根节点Sencha touch 如何搜索嵌套列表,sencha-touch,extjs,sencha-touch-2,Sencha Touch,Extjs,Sencha Touch 2,我正在尝试向嵌套列表添加搜索栏。 添加了搜索栏,当我使用console.log尝试它时,它可以正常工作 它会找到我正在查找的记录,但我不知道如何“刷新”嵌套列表以仅显示搜索结果。如果我使用“mystore.load()”,它会将我带回根节点 Ext.define('Sencha.controller.FileList', { extend: 'Ext.app.Controller', requires: [ 'Ext.Message
Ext.define('Sencha.controller.FileList', {
extend: 'Ext.app.Controller',
requires: [
'Ext.MessageBox'
],
config: {
refs: {
homeBtn: 'button[iconCls=home]',
searchField: 'searchbar'
},
control: {
'button[iconCls=home]': {
tap: 'onbtnHomeTap'
},
'searchField' : {
action : 'onKeyUp'
}
}
},
onbtnHomeTap: function () {
console.log('bthome tapped');
//reloads the list!
Ext.getCmp('myList').getStore().load();
console.log(Ext.getCmp('searchfield').getValue());
},
onKeyUp: function(field) {
console.log('inside searchbar_event');
/* this.doFilter({
q: field.getValue()
});*/
Ext.getStore('NestedListStore').findRecord('text', field.getValue());
},
/**
* @private
* Listener for the 'filter' event fired by the listView set up in the 'list' action. This simply
* gets the form values that the user wants to filter on and tells the Store to filter using them.
*/
doFilter: function(values) {
var store = Ext.getStore('NestedListStore'),
filters = [];
Ext.iterate(values, function(field, value) {
filters.push({
property: field,
value : value
});
});
store.clearFilter();
store.filter(filters);
store.load();
}
});
好的,各位,我回答了我自己的问题: 简单的
Ext.getCmp('yourNestedListID').goToNode( Ext.getStore('NestedListStore').findRecord('text', field.getValue()));
成功了
希望这能对其他人有所帮助。好的,各位,我回答了自己的问题: 简单的
Ext.getCmp('yourNestedListID').goToNode( Ext.getStore('NestedListStore').findRecord('text', field.getValue()));
成功了
希望这能对其他人有所帮助。谢谢!工作得很有魅力!谢谢工作得很有魅力!