Results 1 to 3 of 3

Thread: Using multiple stores for slightly different proxy data

  1. #1

    Default Using multiple stores for slightly different proxy data

    I have a deal store that uses a proxy to get it's data from an api.

    At the moment, there are 3 different lists that each pass a deal type id to the deal store which uses it in it's api and returns a different set of data. It looks like the data is being mixed between the lists when I use pull refresh or change the lists using the tabpanel.

    Should i be creating a store for each deal type, where each store would use the same model but different params?


    Thanks.

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Answers
    102

    Default

    You need to use different store instances then.

  3. #3

    Default

    Just to confirm, you mean like the following:

    Code:
    Ext.regStore('NearHomeStore', {
        model: 'Pub',
        sorters: 'suburb',
        autoLoad: true,
        pageSize: 15,
        clearOnPageLoad: false,
        getGroupString: function(record) {
            return record.get('suburb');
        },
        proxy: {
            type: 'scripttag',
            url: 'http://api.pubbly.com.au/pubs/nearby.json',
            reader: {
                type: 'json',
                root: 'results'
            },
            listeners:{
                exception:function(proxy, response, orientation){
                    Ext.Msg.alert('API connectivity error.', response.statusText);
                }
            }
        }
    });

    Code:
    Ext.regStore('NearCityStore', {
        model: 'Pub',
        sorters: 'suburb',
        autoLoad: true,
        pageSize: 15,
        clearOnPageLoad: false,
        getGroupString: function(record) {
            return record.get('suburb');
        },
        proxy: {
            type: 'scripttag',
            url: 'http://api.pubbly.com.au/pubs/nearby.json',
            reader: {
                type: 'json',
                root: 'results'
            },
            listeners:{
                exception:function(proxy, response, orientation){
                    Ext.Msg.alert('API connectivity error.', response.statusText);
                }
            }
        }
    });

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •