Prometheus
Prometheus

Reputation: 300

getStore(); undefined Sencha Touch 2

I have 2 stores with loaded data.

First store:

Ext.define('Connecting.store.Groups', {
    extend: 'Ext.data.Store',

    requires: [
        'Connecting.model.groupModel',
        'Ext.data.proxy.Ajax',
        'Ext.data.reader.Json'
    ],

    config: {
        autoLoad: true,
        model: 'Connecting.model.groupModel',
        storeId: 'Groups',
        proxy: {
            type: 'ajax',
            url: 'http://localhost/php/getGroups.php',
            reader: {

                    type: 'json'
                }
            }
        }
    });

Second store:

Ext.define('Connecting.store.Secondgroups', {
    extend: 'Ext.data.Store',

    requires: [
        'Connecting.model.Secondgroup',
        'Ext.data.proxy.Ajax',
        'Ext.data.reader.Json'
    ],

    config: {
        autoLoad: true,
        model: 'Connecting.model.Secondgroup',
        storeId: 'Secondgroup',
        proxy: {
            type: 'ajax',
            url: 'http://localhost/php/getSecondGroup.php',
            reader: {
                type: 'json'
            }
        }
    }
});

The first store works;

 var store = Ext.getStore('Groups');
 console.log(store);

But when I change the storeId to 'Secondgroup'(in getStore) my console.log will give me an 'undefined'..

I can't seem the find the problem.. any suggestions in what direction I have to look?

PS. I am using Sencha Architect, but that shouldn't be a problem.

Upvotes: 4

Views: 5151

Answers (1)

arleslie
arleslie

Reputation: 471

Sencha Touch actually uses what you used in the define.

For the second group, try using Ext.getStore('Secondgroups'); and this should work for you.

Upvotes: 4

Related Questions