Correct ExtJS Tab Closing Technique

How can I close the ExtJS tab programmatically?

I need to make this work in IE6; although removing the “tab from the TabPanel works, I see an IE warning: this page contains safe and insecure elements ... When I click X on the tab, I don't see this warning. So, obviously, something smart happens when I click X.

Note: a warning occurs when I use tabPanel.remove (aTab, true), and this does not happen when I use tabPanel.remove (aTab, false). Thus, during deletion, a warning about mixed content and subsequent destruction of the panel is displayed .

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

EDIT

IE tells me that I have mixed SSL content when I don’t

+5
source share
2 answers

Are you deleting a tab element directly or removing a tab component from your container? For instance:.

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

vs.

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

Both should work fine in terms of bookmark layout, but deleting an element directly can have undesirable consequences. If you do the latter (correctly), then I'm not sure what the problem is. I don't have IE 6 at hand.

+7
source

This closes the tab by clicking the middle mouse button.

var middleClick = $(document).mousedown(function(e) {
    if(e.which == 2){
              var tabPanel = <%= tabPanel.ClientID %>;    
              var activeTab = tabPanel.getActiveTab();
              if (e.target.textContent == activeTab.title) {
                  var activeTabIndex = tabPanel.items.findIndex('id', activeTab.id);
                  tabPanel.remove(activeTabIndex);
              }
          }
          return true;
    });

Hope this helps! =)

0
source

All Articles