开发者

Proper technique to close an ExtJS tab

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

IE is telling me I have 开发者_如何学Pythonmixed SSL content when I don't


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.


This closes a tab by clicking the middle button of your mouse.

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 it helps!! =)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜