Results 1 to 2 of 2

Thread: I load the store/model but the list seems emty?

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    130
    Answers
    4

    Default I load the store/model but the list seems emty?

    I load a data, it is from a rest API:
    Code:
    Ext.ModelManager.getModel('Test.model.DogDetails').load(12);
    Yes, it is loaded. I can see api.example.com/dogdetails/12 in the network events. It has one dog ("array")

    I have list inside a container:
    Code:
    Ext.define('Test.view.DogDetails', {
        extend: 'Ext.Container',
        xtype: 'DogDetails',
        //singleton: true,
        config: {
            layout: 'fit',
            items : [
                {
                    xtype: 'list',
                    store: 'DogDetails',
                    itemTpl: [
                        '{NAME}'
                    ],
                    variableHeights: true
                }
            ]
        }
    });
    Then, I click a button to pop up the view.
    Code:
    this.dogD = Ext.widget('DogDetails', {
        title: "hghgh"
    });
    Ext.ComponentQuery.query('dogNavigationView')[0].push(this.dogD);
    And the list is emty. I have checked the list's store and it says that the store has never been loaded. So, it seems that this is not the way how to load the data. But then I have tried to Test.view.DogDetails.items.items[0].getStore().getModel().load(12); This one loads the store that I want but it doesn't load the api.example.com/dogdetails/12, it loads api.example.com/dogdetails/ which is emty. Also I have tried to use singelton, but then Test.view.DogDetails.items.items[0] doesn't exists.

    What is the proper way to pop up a list with a store??

  2. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446

    Default

    Hi--

    The load() you're calling is on the model, not the store, so you're loading the data for an individual model instance, not for the store. Can you share a runnable example of the code you currently have? https://fiddle.sencha.com

    I'll be happy to test this along with you.
    Thanks!
    Joel

Similar Threads

  1. Replies: 2
    Last Post: 3 Jun 2015, 6:37 AM
  2. [OPEN] Problem calling Model.load() after store load call.
    By nikolay.bobrovskiy in forum Ext 5: Bugs
    Replies: 1
    Last Post: 14 Oct 2014, 5:51 AM
  3. Ext.list with REST proxy type, load using model or store?
    By luisparada in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 29 Sep 2014, 4:25 AM
  4. Emty list item
    By bjornravers in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 11 Apr 2013, 6:14 PM
  5. Replies: 4
    Last Post: 4 Apr 2012, 8:05 AM

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
  •