Results 1 to 2 of 2

Thread: Loop on Store setListeners ?

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Paris, France
    Posts
    52
    Answers
    1

    Default Loop on Store setListeners ?

    Hi Guys,
    I'm facing an issue regarding a Store set in a controller to populate an empty list.
    I'm setting the list listeners on the refresh event, but this is called in loop and can't see why...

    Can someone help me to find why the console.log('Loop Alert 2') below is called multiple times ?
    Thanks a lot !

    Code:
    populateList : function(idSection){
            Ext.getStore('store_SectionList').removeAll();
            Ext.getStore('store_SectionList').setProxy({
                type: 'ajax',
                url: occCustoms.getwebServiceURI()+'?id='+idSection,
                reader:{
                    type:'json',
                    rootProperty:'Sections' 
                }
            });
            Ext.getStore('store_SectionList').clearListeners();
            console.log('Loop Alert 1');
            Ext.getStore('store_SectionList').setListeners({
                refresh: function(store){
                    console.log('Loop Alert 2');
                }
            });
            Ext.getStore('store_SectionList').load();
        },

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

    Default

    try using

    Code:
    store.on('refresh', function() {}, store);
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

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

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
  •