1. #1
    Sencha User jsveron23's Avatar
    Join Date
    Feb 2011
    Location
    Seoul, Korea
    Posts
    76
    Vote Rating
    1
    Answers
    1
    jsveron23 is on a distinguished road

      0  

    Default Unanswered: [PR4] Every times more more.......

    Unanswered: [PR4] Every times more more.......


    Code:
        pressSegBtn: function(btn) {
            console.log('1');
            var text  = btn.getText(),
                store = this.getBestList().getStore();
            
            store.clearFilter();
            console.log('2');
            store.on('refresh', function() {
                console.log('3');
            });
            console.log('4');
            store.filter('type', text);
            console.log('5');
        },
    safari console...

    스크린샷 2012-01-27 오후 5.26.22.jpg

  2. #2
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,941
    Vote Rating
    6
    Answers
    29
    edspencer has a spectacular aura about edspencer has a spectacular aura about edspencer has a spectacular aura about

      0  

    Default


    Every time your pressSegBtn function is called it's adding your 'refresh' event listener again, which is why you see it logging '3' more and more often. You only have to call .on once to register your listener - after that it will always be called when the refresh event is fired.

    Usually what you should do is use .on inside a function that is only called once, like the constructor or the initialize function inside a Component. Take a look at the constructor function in examples/kitchensink/app/views/Toolbars.js in the Touch 2 SDK download for an example.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  3. #3
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    Answers
    83
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    approved the thread so everyone can participate.

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

  4. #4
    Sencha User jsveron23's Avatar
    Join Date
    Feb 2011
    Location
    Seoul, Korea
    Posts
    76
    Vote Rating
    1
    Answers
    1
    jsveron23 is on a distinguished road

      0  

    Default


    thx.