0
votes

Simple use case: I want to manually control when I load the store. When the store is loaded, I want the data to populate the list. However, I cannot get it to work.

When I set autoLoad to true on the store, it works. If I remove autoLoad, and add this to the view nothing happens.

List config:

{
   xtype: 'list',
   fullscreen: true,
   disableSelection: true,
   store: 'NewsStore',
   itemId: 'newsList',
   itemTpl: '<li><strong>{date} - {title}</strong><br/>{text}</li>',
   plugins: [
   {
       xclass: 'Ext.ux.touch.PullRefreshFn',
       pullText: 'Henter nyheter',
       refreshFn: function () {
           Ext.getStore('NewsStore').load();
       }
   }
]}

The listener on the panel will load the store:

listeners: {
        painted: function () {
            Ext.getStore('NewsStore').load();
        }
    }

I have tried to use the callback from the load method. I have tried to get the store from the list and update this, nothing works (the list is simply empty and does not display anything, even though I can see that the code is fetching the information). Any idea what I am doing wrong here?

1
How are you binding the store to the view? It would be good to see the full view configuration. - Stuart
Added the list config. Its really just a Ext.Panel with this list as content. I even tried to do a Ext.create(store) in the store-property of the list, but this also did not work. - Jarle Hansen

1 Answers

0
votes

You have to use setStore property to populate the data

var myStore = Ext.getStore('NewsStore');

Now access the list object and just 

mylist.setStore(myStore);