Results 1 to 5 of 5

Thread: Can't load store

  1. #1

    Default Answered: Can't load store

    Hi, I'm having a problem trying to load a store from a View Controller.


    Here's the store:
    PHP Code:
    Ext.define('Emailapplication.extjs.store.MessageStore', {
      
    extend'Ext.data.Store',
      
    model'Emailapplication.extjs.model.MessageModel',
      
    storeId'messageStore',
      
    autoSynctrue
    }) 

    In the controller I'm doing
    PHP Code:
    Ext.getStore('messageStore'
    and that returns 'undefined'

    However, if I create the store within my controller, it works fine (but this is far from ideal) as I want to use the store outside of the context it's created (and want to avoid multiple trips to the API for the same data).



    PHP Code:
    var store Ext.create('Ext.data.Store', {
      
    model'Emailapplication.extjs.model.MessageModel',
      
    autoSynctrue
    }) 

    Please advise.

  2. Where are you instantiating the store? Are you creating the store somewhere or putting it in a stores array on the application? Just putting storeId on a store definition doesn't mean that store will be instantiated for you.

    If the Ext.getStore returns undefined, that means the store hasn't been instantiated yet.

  3. #2
    Sencha - Support Team bjdurham85's Avatar
    Join Date
    Mar 2014
    Posts
    962
    Answers
    55

    Default

    You'll likely need more than just a store define. How have you hooked it up to your actual view(i.e. stores config in ViewModel, defined on component itself)?

    If you have a Fiddle demonstrating your scenario I'd be happy to take a look as well.

    Best!
    Bryan

  4. #3

    Default

    The store indicates which model to use, shouldn't this be enough? If not, I've tried adding
    Code:
    store: 'messageStore'
    to both the view controller and to the model but to no avail.

  5. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    Where are you instantiating the store? Are you creating the store somewhere or putting it in a stores array on the application? Just putting storeId on a store definition doesn't mean that store will be instantiated for you.

    If the Ext.getStore returns undefined, that means the store hasn't been instantiated yet.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  6. #5

    Default

    Ok, so in this instance it means I need
    Code:
    store: Ext.create('Emailapplication.extjs.store.MessageStore')
    in my controller before I can call
    Code:
    Ext.getStore()
    Thanks guys.

Similar Threads

  1. Replies: 1
    Last Post: 25 Sep 2014, 7:07 AM
  2. Replies: 2
    Last Post: 28 Mar 2014, 12:09 PM
  3. Replies: 1
    Last Post: 28 Jan 2014, 12:17 PM
  4. [FIXED] First Tutorial Load JSON Store not working: Unable to load data using. . . ."
    By technorodent in forum Sencha Architect 2.x: Bugs
    Replies: 14
    Last Post: 20 Jun 2013, 12:03 PM
  5. Replies: 1
    Last Post: 18 Apr 2012, 1:55 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •