1. #1
    Sencha User jsveron23's Avatar
    Join Date
    Feb 2011
    Location
    Seoul, Korea
    Posts
    78
    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,939
    Vote Rating
    9
    Answers
    29
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      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
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    Answers
    102
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    approved the thread so everyone can participate.

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

      0  

    Default


    thx.