extjs - How to use a custom storeId with MVC? -
given store this, @ runtime, storeid
app.store.entities
instead of entities
:
ext.define('app.store.entities', { extend: 'ext.data.store', storeid: 'entites',
the documentation states:
note when store instatiated controller, storeid overridden name of store.
this not true when store required in controller with
stores: ['app.store.entities'],
but when asynchroneously created
this.getstore('app.store.entities')
this expected behavior, don't fact, behavior forces use of either
- the qualfied name
app.store.entities
- or stick rigid naming convention and directory structure.
the problem
the problem have app grows quite large, , having store
definitions in 1 store
folder no longer option. i'd refactor have folder structure follows.
/app /plugin1 /store /settings /details /model /view /plugin2 /store /items /settings /model /view
if force storeid
, define 'plugin1.settings'
, come more readable , more portable code repeating 'app.plugin1.store.settings'
on place.
how possibly solve issue ? go off start ?
actually, not let ext instantiate stores (only in rare cases) because prevents creating multiple instances of same view class. instantiate stores manually in views' initcomponent
overrides.
this allows me seamless multiple instances plus choose storeid
if wished - don't use storeid i'm getting stores views.
however, if need choose storeid because of folder organization, can use shorter names such subfolder1.storename1
, etc. folder structure must split inside store
folder.
app/store/subfolder1
app/store/subfolder2
Comments
Post a Comment