-
27 Jan 2012 12:27 AM #1
Unanswered: [PR4] Every times more more.......
Unanswered: [PR4] Every times more more.......
safari console...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'); },
스크린샷 2012-01-27 오후 5.26.22.jpg
-
27 Jan 2012 12:44 AM #2Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
- Answers
- 29
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
-
27 Jan 2012 1:38 PM #3Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
- Answers
- 83
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.
-
3 Feb 2012 3:10 AM #4


Reply With Quote