Reputation: 4115
I am trying to setup a localStorage to save the Authentication Token received from my REST service, but unfortunately i keep getting the error that functions related to the store does not exist:
TypeError: Ext.getStore is not a function
var test = Ext.getStore('myPhysioStorage');
My implementation:
store/UserStore.js
Ext.define('Physio.model.UserStore'), {
extend: 'Ext.data.Model',
config: {
fields: [
'sessiontoken'
]
}
});
model/UserStore.js
Ext.define('Physio.store.UserStore'), {
extend: 'Ext.data.Store',
requires: 'Physio.model.UserStore',
config: {
model: 'Physio.model.UserStore',
autoload: true,
storeId: 'myPhysioStorage',
proxy: {
type: 'localStorage',
id: 'myPhysioStorageProxy'
}
}
});
controller/Login.js
...
launch: function() {
var test = Ext.getStore('myPhysioStorage');
console.log(userStore);
}
...
app.js
Ext.application({
name: 'Physio',
views: ['Login','MainMenu'],
controllers:['Login','MainMenu'],
store:['UserStore'],
model:['UserStore'],
launch: function () {
Ext.Viewport.add([
{ xtype: 'loginview' },
{ xtype: 'mainmenuview' }
]);
}
});
Upvotes: 0
Views: 54
Reputation: 25401
Have you included your app.js
and the sencha touch lib sencha-touch.js
in your html page?
<script type="text/javascript" src="lib/sencha-touch/sencha-touch.js"></script>
<script type="text/javascript" src="app/app.js"></script>
Have you also added Ext.data.Store
in the requires attribute in your Ext.application
?
Ext.application({
name: 'name',
requires: [
'Ext.data.Store', 'some more'
],
....
});
Upvotes: 1