Question

I'm working on a sencha touch project and i want to add a record to my store. here is my model :

Ext.define('FriendsWithBeer.model.Friend', {
extend: 'Ext.data.Model',

requires: [
    'Ext.data.Field',
    'Ext.data.proxy.LocalStorage'
],

config: {
    fields: [
        {
            name: 'firstName'
        },
        {
            name: 'lastName'
        },
        {
            name: 'address'
        },
        {
            name: 'zip'
        },
        {
            name: 'email'
        },
        {
            name: 'phone'
        },
        {
            name: 'favoriteBeer'
        },
        {
            name: 'lat'
        },
        {
            name: 'lng'
        },
        {
            name: 'distance'
        }
    ],
    proxy: {
        type: 'localstorage',
        id: 'FriendsWithBeerContacts'
    }
}
});

my store is the following :

Ext.define('FriendsWithBeer.store.Friends', {
extend: 'Ext.data.Store',

requires: [
    'FriendsWithBeer.model.Friend',
    'Ext.util.Grouper'
],

config: {
    autoLoad: true,
    autoSync: true,
    model: 'FriendsWithBeer.model.Friend',
    storeId: 'Friends',
    sorters: {
        property: 'lastName'
    },
    grouper: {
        groupFn: function(item) {
            return item.get('lastName')[0];
        }
    }
}
});

Now, in my chrome console, I've entered :

Ext.getStore('Friends').add(
{firstName: 'Steve', lastName: 'Drucker'}
);

so i have the following error :

TypeError: undefined is not a function

can you please help me ?

Était-ce utile?

La solution

the solution is : go to Library Base Path in your sencha touch project and add the path to your sencha touch library.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top