Extjs sencha touch routing extraparams厨房水槽
我正在尝试扩展Sencha Touch Kitchensink应用程序中的路由,如下所示:Extjs sencha touch routing extraparams厨房水槽,extjs,routes,touch,metadata,Extjs,Routes,Touch,Metadata,我正在尝试扩展Sencha Touch Kitchensink应用程序中的路由,如下所示: { category: 'fruit', str: 'tomato'}, { category: 'fruit', str: 'green bean'}, { category: 'vegetable', str: 'celery'}, { category: 'vegetable', str: 'sprouts'}, { category: 'notAVegetable', str: 'ketchup'
{ category: 'fruit', str: 'tomato'},
{ category: 'fruit', str: 'green bean'},
{ category: 'vegetable', str: 'celery'},
{ category: 'vegetable', str: 'sprouts'},
{ category: 'notAVegetable', str: 'ketchup'},
{ category: 'notAVegetable', str: 'prune'}
{
text: 'List',
leaf: true,
id: 'list',
extraParams: {
category: 'fruit'
}
},
我的数据(在列表存储中)如下所示:
{ category: 'fruit', str: 'tomato'},
{ category: 'fruit', str: 'green bean'},
{ category: 'vegetable', str: 'celery'},
{ category: 'vegetable', str: 'sprouts'},
{ category: 'notAVegetable', str: 'ketchup'},
{ category: 'notAVegetable', str: 'prune'}
{
text: 'List',
leaf: true,
id: 'list',
extraParams: {
category: 'fruit'
}
},
我只想显示由特定类别选择的数据,例如“水果”
在Main.js控制器中,我试图通过从Demos TreeStore中的“List”节点获取另一个参数来实现这一点
routes: {
'demo/:id/:category': 'showViewById',
'menu/:id': 'showMenuById'
},
其中showViewById操作添加了额外的参数以供以后使用
showViewById: function (id, category) {
var nav = this.getNav(),
view = nav.getStore().getNodeById(id);
console.log('view ' + id);
this.showView(view);
this.setCurrentDemo(view);
this.hideSheets();
// do stuff with category
},
我正在尝试在“列表”树节点中的我的Demos.js存储中添加并访问“category”,如下所示:
{ category: 'fruit', str: 'tomato'},
{ category: 'fruit', str: 'green bean'},
{ category: 'vegetable', str: 'celery'},
{ category: 'vegetable', str: 'sprouts'},
{ category: 'notAVegetable', str: 'ketchup'},
{ category: 'notAVegetable', str: 'prune'}
{
text: 'List',
leaf: true,
id: 'list',
extraParams: {
category: 'fruit'
}
},
几个问题:我可以使用extraParameter将此属性添加到存储吗?如果是,我如何访问它以用于我的路由?我原以为它可以作为演示商店的元数据使用,但一直无法访问它
除了创建多个商店(一个用于“水果”、“蔬菜”、“蔬菜”等)并在其上设置过滤器以实现相同的目标之外,还有其他选择吗
蒂亚