1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Paris, France
    Posts
    43
    Vote Rating
    0
    Answers
    1
    Arekkk is on a distinguished road

      0  

    Default Unanswered: Loop on Store setListeners ?

    Unanswered: 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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,710
    Vote Rating
    436
    Answers
    3113
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    try using

    Code:
    store.on('refresh', function() {}, store);
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.