0

リストビューで一連のアイテムを表示しようとしています。サーバーには、単一のファイル内のすべてのアイテムが、各サブカテゴリに割り当てられたカテゴリ ID を持つさまざまなサブカテゴリに属しています。現在、フィルターが適用されていない場合、すべてのデータをインポートできるストアがあります。その場合、その特定のサブカテゴリに属する​​アイテムが表示されます。

私の店舗コードは以下の通りです。

 Ext.define('RestaurantGlobal.store.SubCategoryColumnsStoreNonVeg', {
     extend: 'Ext.data.Store',

     requires: [
         'RestaurantGlobal.model.ItemColumns'
     ],

     config: {
         autoLoad: false,
         model: 'RestaurantGlobal.model.ItemColumns',
         storeId: 'SubCategoryColumnsStoreNonVeg',
         proxy: {
             type: 'ajax',
             url: 'data/NonVegItemsColumnsStore.json',
             reader: {
                 type: 'json',
                 rootProperty: 'Item'
             }
         },
         filters: [{
                     property: 'SubCategory_id',
                     value: /0c9b01f6b3b2493b907a42e07010064800001/
                 }]
     },
 });

私のアプリには、カテゴリのリストを表示するカテゴリ ビューと、選択されたカテゴリに属する​​アイテムを含むサブ カテゴリ ビューがあります。前のビューでユーザーが選択したカテゴリに基づいて、ストアから受信したデータを動的にフィルタリングし、リストに表示したいと考えています。私のリストビューコードは次のとおりです。

 Ext.define('RestaurantGlobal.view.SubCategories', {
     extend: 'Ext.navigation.View',
     xtype: 'SubCategories',

config: {
    layout: {
        type: 'card'
    },
    items:[
        {
            xtype: 'container',
            title: 'Category Name',
            styleHtmlCls: 'maincontainer',
            styleHtmlContent: true,
            layout: {
                type: 'vbox'
            },
             items: [
                        {
                            xtype: 'container',
                            title: 'Non-Veg',
                            margin: '0 10 0 10',
                            items: [
                                {
                                    xtype: 'list',
                                    id: 'nonVegList',
                                    autoPaging: true,
                                    height: '100%',
                                    store: 'SubCategoryColumnsStoreVeg',
                                    itemTpl: [
                                         '<div>{Image}{Name}</div>'
                                    ],
                                },
                            ]
                        },        
                        {
                                xtype: 'container',
                                items: [
                                  {
                                     xtype: 'button',
                                     cls: 'btn',
                                     docked: 'bottom',
                                     margin: '0 0 0 0',
                                     text: 'Place Order'
                                  }
                                ]
                        }
                  ]
             }
        ]
     } 
});  

私のコントローラーには、前のカテゴリ ビューに割り当てられたアイテム タップ機能があります。関数はここに書かれています:

  onCustomDataViewItemTap: function(dataview, index, target, record, e, eOpts) {
    categoryId = record._data.id;

    var NonVegStore =       Ext.create('RestaurantGlobal.store.SubCategoryColumnsStoreNonVeg');
    // clear all existing filters
    NonVegStore.clearFilter();
    NonVegStore.filter('SubCategory_id', '/' + categoryId + '/');
    NonVegStore.load();
    var NVList = this.getNonVegList;
    NVList.setStore(NonVegStore);

    var SubCategories = Ext.create('RestaurantGlobal.view.SubCategories');
    Ext.Viewport.add(SubCategories);
    Ext.Viewport.setActiveItem(SubCategories);
},

フィルターを追加し、ストアをリロードしてリストで使用しましたが、「setStore」メソッドが使用できないというエラーが表示されます。フィルターを動的に正しく実装するのを手伝ってくれる人はいますか?

4

1 に答える 1