views:

1511

answers:

1

What is the proper way to close an ExtJS tab programmatically?

I need to make this work in IE6; although remove'ing the tab from the TabPanel works, I see an IE warning: This page contains secure and unsecure items... When I click the X on the tab, I do not see this warning. So, clearly something clever is happening when I click the X.

Note: the warning occurs when I use tabPanel.remove(aTab, true) and it does not occur when I use tabPanel.remove(aTab, false). So, the mixed content warning is displayed during the removal and subsequent destruction of the panel.

Does it make sense to simulate the click on a tab?

EDIT

http://stackoverflow.com/questions/726244/ie-is-telling-me-i-have-mixed-ssl-content-when-i-dont

+2  A: 

Are you removing the tab's element directly, or are you removing the tab component from its container? E.g.:

Ext.fly('tab-id').remove(); // Element API

vs.

myTabPanel.remove('tab-id'); // Panel API

Both should work OK in terms of nuking the tab markup, but removing the element directly may have undesirable consequences. If you are doing the latter (correct), then I'm not sure what the issue might be. I don't have IE 6 handy myself.

bmoeskau
I'm doing the latter. The code works fine - in that the panel is removed - but I see the warning. I should add that I am destroying the panel during removal; I am certain that the warning occurs during the destruction.
Upper Stage
I'm assuming that your page is running under https -- have you verified that all images and other resources use https urls? Again, not sure why it would be different only in the circumstance you mentioned though. Internally, TabPanel's onStripMouseDown() is the relevant method to look at, and it does this.remove(t.item); Note that you are passing false for autoDestroy -- are you destroying the tab later?
bmoeskau
https: yes. All resources https: yes. onStripMouseDown does indeed perform this.remove(t.item) sans destroy. I am destroying the tab when I remove; I believe the problem occurs during the destruction (maybe the destruction is sloppy?). Does it make sense to remove without a destroy? Seems like a memory leak to me.
Upper Stage
The problem does not occur when I close the X to close the tab - I think I'll try to simulate the click.
Upper Stage
Simulating the click would be equivalent to simply not destroying the tab, right? How are you destroying it currently? You might try narrowing down what content in the tab is actually triggering this error too by selectively removing stuff -- does it trigger on any tab destruction? Seems like this would be a known bug in Ext. If it is a particular resource maybe you could fix it on that end.
bmoeskau
I've tried to destroy this particular tab two ways: tabPanel.remove(aTab, true) and tabPanel.remove(aTab); aTab.destroy(); both of these techniques succeed, but result in a warning. I like your idea of destroying selective parts of the tab; thanks.
Upper Stage