Sencha touch 如何过滤商店?
谁知道如何正确过滤商店 我试图在嵌套列表的leafItemTap的侦听器中执行此操作,但我的leaf items现在没有点击。控制台中的消息:“未捕获的TypeError:无法调用未定义的方法“filter” 这是嵌套列表,必须在其中筛选存储:Sencha touch 如何过滤商店?,sencha-touch,extjs,sencha-touch-2,Sencha Touch,Extjs,Sencha Touch 2,谁知道如何正确过滤商店 我试图在嵌套列表的leafItemTap的侦听器中执行此操作,但我的leaf items现在没有点击。控制台中的消息:“未捕获的TypeError:无法调用未定义的方法“filter” 这是嵌套列表,必须在其中筛选存储: Ext.define('Application.view.SplitView', { extend: 'Ext.Container', xtype: 'splitview', config: { layout: 'card',
Ext.define('Application.view.SplitView', {
extend: 'Ext.Container',
xtype: 'splitview',
config: {
layout: 'card',
store: null
},
initialize: function() {
this.nestedList = Ext.create('Ext.NestedList', {
title : 'Рецепты',
detailCard: Ext.create('Application.view.MainDetail'),
store: this.getStore(),
listeners: {
scope: this,
leafitemtap: this.onLeafItemTap
}
});
this.setItems([this.nestedList]);
},
updateStore: function(newStore) {
if (this.nestedList) {
this.nestedList.setStore(newStore);
}
},
onLeafItemTap: function(nestedList, list, index, node, record, e) {
var psn = record.get('text');
console.log(psn);
var detailCard = nestedList.getDetailCard();
var store = Ext.getStore('Application.store.DetailStore');
store.filter('title', 'Brownies');
console.log(store);
}
}))
这是我的店铺,我要筛选它:
Ext.define('Application.store.DetailStore', {
extend: 'Ext.data.Store',
config: {
model: 'Application.model.DetailModel',
autoLoad :true,
sorters: 'title',
grouper : function(record) {
return record.get('title')[0];
},
proxy: {
type: 'ajax',
url : '/data/data1.php',
reader: {
type: 'json',
rootProperty:'recipes'}
}
}
}))
以及商店的型号:
Ext.define('Application.model.DetailModel', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'title', type: 'string'},
{name: 'serves', type: 'string'},
{name: 'cooktime', type: 'string'},
{name: 'ingridients', type: 'string'},
{name: 'picture', type: 'string'},
{name: 'kitchen', type: 'string'},
{name: 'category', type: 'string'},
{name: 'instructions', type: 'string'}
]
},
fullName: function() {
var d = this.data,
names = [
d.title
];
return names.join(" ");
}
}))
我是Sencha的新手,每个建议都很有用以下错误意味着调用
过滤器
函数的对象未定义
“未捕获的TypeError:无法调用未定义的方法'filter'”
在您的情况下,存储是未定义的
尝试通过以下方式获得:
var store = Ext.getStore('DetailStore');
此外,您还可以通过执行以下操作来检查StoreManager中的商店:
console.log(Ext.data.StoreManager.all);
希望这对您有所帮助当您执行
console.log(store)时会得到什么代码>过滤前?它返回“未定义”,我在获取存储时出错了?