Search code examples
extjsextjs4sencha-touchextjs4.1sencha-architect

sencha architect store config as an object


I'm trying to do this:

...
store: ZAdmin.store.TreeFactory.create('ZAdmin.model.Category', 'Application\\Entity\\Category')
...

But getting:

...    
store: 'ZAdmin.store.TreeFactory.create(\'ZAdmin.model.Category\', \'Application\\Entity\\Category\')'
...

There is no way to change store from string to object type.

How to fix it?

P.S. I'm about editing config properties in GUI. Sencha Architect assumes store to be a string, so auto-escapes any value.


Solution

  • store config takes store object or its name, so in case you want to pass an object you can either create it in-place OR in initialize method you can do this:

    var myStore = ZAdmin.store.TreeFactory.create('ZAdmin.model.Category', 'Application\\Entity\\Category'); // Any kind of store creation
    this.setStore(myStore);
    myStore.load();   // Optional
    

    having late store association/load gives you advantage of quickly showing the view without waiting for data to load.