Search code examples
javascriptextjs4

extjs 4 store is undefined


I'm creating a simple store in coffeescript but it returns as undefined when I call it in the browser console Ext.getStore('visitors')

Ext.define 'heroico.store.Visitors',
    extend: 'Ext.data.Store'
    model: 'heroico.model.Visitor'
    storeId: 'visitors'

If I create it without actually extending 'Ext.data.Store' I can find it via getStore method but then I can't load it in my controller in the stores array:

Ext.create 'Ext.data.Store',
    model: 'heroico.model.Visitor'
    storeId: 'visitors'

Any idea why it would behave this way?


Solution

  • Controllers automatically initialize stores. If you have it in your controller's stores array and it isn't getting loaded, make sure your controller is getting loaded by listing it in your controllers array in Application.js. Also make sure you are correctly listing it in your stores array, you didn't post that code. Check the console for any errors.