I did my project Build and I´m receiving an error, my app is not recognizing the session stores.
proxy: {
type: 'sessionstorage',
id: 'sessionTimeline',
reader: {
type: 'json',
rootProperty: 'query'
}
}
When I change the type to "memory" my code works fine, but the type must be sessionstorage because I want to keep all the data from my store saved when I refresh my page.
Uncaught Error: [Ext.createByAlias] Unrecognized alias: proxy.sessionstorage at Ext.Inventory.instantiateByAlias (app.js?_dc=1493205201288:13481) at Object.createByAlias (app.js?_dc=1493205201288:5423) at constructor.applyProxy (app.js?_dc=1493205201288:85923) at constructor.setter [as setProxy] (app.js?_dc=1493205201288:9021) at constructor. (app.js?_dc=1493205201288:9000) at constructor.createImplicitModel (app.js?_dc=1493205201288:86564) at constructor.applyFields (app.js?_dc=1493205201288:85893) at constructor.setter [as setFields] (app.js?_dc=1493205201288:9021) at Ext.Configurator.configure (app.js?_dc=1493205201288:9610) at constructor.initConfig (app.js?_dc=1493205201288:11119)
I don't know whats going wrong because my app could recognize the session storage before the build, I tried to fix this bug in many ways, but is really hard because the app.js is compact.
My session storage code:
Ext.define('ES.store.Timeline', {
extend: 'Ext.data.Store',
alias: 'store.timeline',
storeId: 'timeline',
fields: [{
name: 'vid',
type: 'int'
}, {
name: 'time',
type: 'string'
}, {
name: 'lat',
type: 'float'
}, {
name: 'lng',
type: 'float'
}, {
name: 'address',
type: 'string'
}, {
name: 'dir',
type: 'string'
}, {
name: 'vel',
type: 'string'
}, 'hidden'],
pageSize: 500,
autoSync: true,
sorters: [{
property: 'time',
direction: 'DESC'
}],
data: {
query: []
},
proxy: {
type: 'sessionstorage',
id: 'sessionTimeline'
},
filters: [{
property: 'hidden',
value: false
}]
});
I'm calling the session store on a view:
...
store: {
type: 'timeline'
},
...
How can I fix that bug? Thank you.
You are missing a requires on your store:
requires:[
'Ext.data.proxy.SessionStorage'
]
This tells ExtJS to load the file data/proxy/SessionStorage.js
before construction of the store. Only when the data/proxy/SessionStorage.js
file is loaded, the alias proxy.sessionstorage
is registered, and thus, the proxy factory can correctly instantiate the proxy.