I'm relatively new to cross-platform mobile development, and recently have been going through some basic tutorials on how to use Sencha Touch in my app. I have been confused by what seems to me as inconsistency in their methodology. So here is my question:
I am using the MVC design pattern. When defining a proxy for storing data in an app, should I do this in the Model or in the Store? I have seen both done and am not sure which is better, or the cases when each should be used. The following are examples of what I mean:
Proxy defined in the Store:
App.stores.users = new Ext.data.Store({
model: 'User',
autoLoad: true,
proxy: {
type: 'localstorage',
id: 'sencha-users'
}
});
Proxy defined in the Model:
App.models.User = Ext.regModel('User', {
fields: [
{
name: 'email',
type: 'string'
}, {
name: 'firstname',
type: 'string'
}, {
name: 'lastname',
type: 'string'
}, {
name: 'password',
type: 'string'
}
],
proxy: {
type: 'localstorage',
id: 'sencha-users'
}
});