Home > Web Front-end > JS Tutorial > Implementation ideas and code for extjs tabpanel to limit the number of tabs_extjs

Implementation ideas and code for extjs tabpanel to limit the number of tabs_extjs

WBOY
Release: 2016-05-16 17:38:26
Original
1227 people have browsed it
Copy code 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
* and load the specified resources into the window
* @param node: the incoming Node node
*/
var loadPanel = function(node) {
var id= node.id;//Get the id of the node
tabIndex7 = id;
var href = node.attributes.href; //Get the href attribute in 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));//Get the component object with the specified id
if(tab ) {
mainPanel.setActiveTab(tab);//Check whether the current Tab exists. If it exists, just activate it
return;
}
//If the tab does not exist, the following is Create tab code
tab = mainPanel.add(new Ext.Panel ({
//Configuration to create a new tab
id: String(id),//Set ID, need to be forced to string Type
title: text,//Set tab title
tabTip: text,
html: '