PDA

View Full Version : TabPanel.removeAll() triggering tabchange events



PV-Patrick
3 Apr 2012, 12:45 AM
I have a TabPanel and listener on tabchange. The problem I am experiencing is when I perform a removeAll(true) on the TabPanel to remove the tabs and add new tabs to the Panel, it triggers a tabchange event for each tab that is removed. How can I stop that from happening and is this the default behavior?

evant
3 Apr 2012, 12:56 AM
Yes, it's the default behaviour, you're removing tabs.

You could call suspendEvents() so you don't receive any:



tabs.suspendEvents();
tabs.removeAll();
tabs.resumeEvents();

PV-Patrick
3 Apr 2012, 9:30 AM
You could call suspendEvents() so you don't receive any:



tabs.suspendEvents();
tabs.removeAll();
tabs.resumeEvents();


Thanks for the response evant! I tried to use the suspendEvents and it's still triggering events when performing a removeAll(). I have tried with and without bool true, with and without resume, etc.


console.log('1');
me.suspendEvents();
me.removeAll(true);
console.log('2');

The tabchange event is still fired on removeAll() and it's between the 1 & 2 so I am confident the events are being triggered from that. Any other ideas?

PV-Patrick
4 Apr 2012, 11:02 AM
Any suggestions on why the suspendEvents() method isn't working? Does it not apply to the removeAll() method?

senchasensei
28 Jan 2014, 4:53 PM
Yes, it's the default behaviour, you're removing tabs.

You could call suspendEvents() so you don't receive any:



tabs.suspendEvents();
tabs.removeAll();
tabs.resumeEvents();


I was having the same problem and this solution worked for me.

Thank you!

pankajsharma2000
16 Apr 2014, 2:49 PM
suspendEvents() and resumeEvents() is not working for me also:


Ext.ComponentQuery.query('#someTabPanel')[0].suspendEvents();
Ext.ComponentQuery.query('#someTabPanel')[0].removeAll();
Ext.ComponentQuery.query('#someTabPanel')[0].resumeEvents();