The variable storage id is used to swap IDs when loading new cards, thus limiting the number of opened tabs. If this effect is not required, we recommend that you do not close and create tabpanel frequently, if you are interested, refer
The Code is as follows:
Var tabIndex = 'shouye ';
Var tabIndex2 = 'shouye ';
Var tabIndex3 = 'shouye ';
Var tabIndex4 = 'shouye ';
Var tabIndex5 = 'shouye ';
Var tabIndex6 = 'shouye ';
Var tabIndex7 = 'shouye ';
/**
* Add a window to the TabPanel component or activate an existing window.
* Load the specified resource into the window.
* @ Param node: the input Node
*/
Var loadPanel = function (node ){
Var id = node. id; // obtain the node id
TabIndex7 = id;
Var href = node. attributes. href; // obtain the href attribute of the node.
Var text = node. text;
Var mainPanel = Ext. getCmp ('mainpanel ');
// MainPanel. remove ('mainpanel ', true );
Var qtip = node. attributes. qtip;
Var tab = mainPanel. getComponent (String (id); // gets the Component Object of the specified id
If (tab ){
MainPanel. setActiveTab (tab); // check whether the current Tab exists. If it exists, you only need to activate it.
Return;
}
// If the tab does not exist, the code for creating the tab is as follows:
Tab = mainPanel. add (new Ext. Panel ({
// Create a new tab Configuration
Id: String (id), // Set ID, which must be forcibly converted to the string type
Title: text, // set the tab title
TabTip: text,
Html :'',
AutoScroll: true,
EnableTabScroll: true,
Defaults: {autoScroll: true },
Closable: true // whether it can be disabled
}));
MainPanel. setActiveTab (tab); // after creating a tab, activate it.
MainPanel. remove (tabIndex, true );
TabIndex = tabIndex2;
TabIndex2 = tabIndex3;
TabIndex3 = tabIndex4;
TabIndex4 = tabIndex5;
TabIndex5 = tabIndex6;
TabIndex6 = tabIndex7;
}
The variable storage id is used to swap the id when loading the new selected card, thus limiting the number of opened tabs. If this effect is not required, we recommend that you do not close and create tabpanel frequently.