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: 'notAVegetable', str: 'prune'}
「果物」など、特定のカテゴリで選択したデータのみを表示したい
Main.js コントローラーでは、Demo 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
},
次のように、「List」ツリーノードの Demos.js ストアに extraParameter として「category」を追加してアクセスしようとしています。
{
text: 'List',
leaf: true,
id: 'list',
extraParams: {
category: 'fruit'
}
},
いくつか質問があります。extraParameter を使用してこの属性をストアに追加できますか? もしそうなら、どのようにアクセスしてルーティングに使用できますか? デモ ストアのメタデータとして利用できると思っていましたが、アクセスできませんでした。
同じことを達成するためにフィルターを使用して複数のストア (「果物」、「野菜」、「notAVegetable」など) を作成する以外に、代替手段はありますか?
ティア!