Panel2.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-tab-Panel'>/**
  19. </span> * @author Ed Spencer, Tommy Maintz, Brian Moeskau
  20. *
  21. * A basic tab container. TabPanels can be used exactly like a standard {@link Ext.panel.Panel} for
  22. * layout purposes, but also have special support for containing child Components
  23. * (`{@link Ext.container.Container#cfg-items items}`) that are managed using a
  24. * {@link Ext.layout.container.Card CardLayout layout manager}, and displayed as separate tabs.
  25. *
  26. * **Note:** By default, a tab's close tool _destroys_ the child tab Component and all its descendants.
  27. * This makes the child tab Component, and all its descendants **unusable**. To enable re-use of a tab,
  28. * configure the TabPanel with `{@link #autoDestroy autoDestroy: false}`.
  29. *
  30. * ## TabPanel's layout
  31. *
  32. * TabPanels use a Dock layout to position the {@link Ext.tab.Bar TabBar} at the top of the widget.
  33. * Panels added to the TabPanel will have their header hidden by default because the Tab will
  34. * automatically take the Panel's configured title and icon.
  35. *
  36. * TabPanels use their {@link Ext.panel.Header header} or {@link Ext.panel.Panel#fbar footer}
  37. * element (depending on the {@link #tabPosition} configuration) to accommodate the tab selector buttons.
  38. * This means that a TabPanel will not display any configured title, and will not display any configured
  39. * header {@link Ext.panel.Panel#tools tools}.
  40. *
  41. * To display a header, embed the TabPanel in a {@link Ext.panel.Panel Panel} which uses
  42. * `{@link Ext.container.Container#layout layout: 'fit'}`.
  43. *
  44. * ## Controlling tabs
  45. *
  46. * Configuration options for the {@link Ext.tab.Tab} that represents the component can be passed in
  47. * by specifying the tabConfig option:
  48. *
  49. * @example
  50. * Ext.create('Ext.tab.Panel', {
  51. * width: 400,
  52. * height: 400,
  53. * renderTo: document.body,
  54. * items: [{
  55. * title: 'Foo'
  56. * }, {
  57. * title: 'Bar',
  58. * tabConfig: {
  59. * title: 'Custom Title',
  60. * tooltip: 'A button tooltip'
  61. * }
  62. * }]
  63. * });
  64. *
  65. * # Examples
  66. *
  67. * Here is a basic TabPanel rendered to the body. This also shows the useful configuration {@link #activeTab},
  68. * which allows you to set the active tab on render. If you do not set an {@link #activeTab}, no tabs will be
  69. * active by default.
  70. *
  71. * @example
  72. * Ext.create('Ext.tab.Panel', {
  73. * width: 300,
  74. * height: 200,
  75. * activeTab: 0,
  76. * items: [
  77. * {
  78. * title: 'Tab 1',
  79. * bodyPadding: 10,
  80. * html : 'A simple tab'
  81. * },
  82. * {
  83. * title: 'Tab 2',
  84. * html : 'Another one'
  85. * }
  86. * ],
  87. * renderTo : Ext.getBody()
  88. * });
  89. *
  90. * It is easy to control the visibility of items in the tab bar. Specify hidden: true to have the
  91. * tab button hidden initially. Items can be subsequently hidden and show by accessing the
  92. * tab property on the child item.
  93. *
  94. * @example
  95. * var tabs = Ext.create('Ext.tab.Panel', {
  96. * width: 400,
  97. * height: 400,
  98. * renderTo: document.body,
  99. * items: [{
  100. * title: 'Home',
  101. * html: 'Home',
  102. * itemId: 'home'
  103. * }, {
  104. * title: 'Users',
  105. * html: 'Users',
  106. * itemId: 'users',
  107. * hidden: true
  108. * }, {
  109. * title: 'Tickets',
  110. * html: 'Tickets',
  111. * itemId: 'tickets'
  112. * }]
  113. * });
  114. *
  115. * setTimeout(function(){
  116. * tabs.child('#home').tab.hide();
  117. * var users = tabs.child('#users');
  118. * users.tab.show();
  119. * tabs.setActiveTab(users);
  120. * }, 1000);
  121. *
  122. * You can remove the background of the TabBar by setting the {@link #plain} property to `true`.
  123. *
  124. * @example
  125. * Ext.create('Ext.tab.Panel', {
  126. * width: 300,
  127. * height: 200,
  128. * activeTab: 0,
  129. * plain: true,
  130. * items: [
  131. * {
  132. * title: 'Tab 1',
  133. * bodyPadding: 10,
  134. * html : 'A simple tab'
  135. * },
  136. * {
  137. * title: 'Tab 2',
  138. * html : 'Another one'
  139. * }
  140. * ],
  141. * renderTo : Ext.getBody()
  142. * });
  143. *
  144. * Another useful configuration of TabPanel is {@link #tabPosition}. This allows you to change the
  145. * position where the tabs are displayed. The available options for this are `'top'` (default) and
  146. * `'bottom'`.
  147. *
  148. * @example
  149. * Ext.create('Ext.tab.Panel', {
  150. * width: 300,
  151. * height: 200,
  152. * activeTab: 0,
  153. * bodyPadding: 10,
  154. * tabPosition: 'bottom',
  155. * items: [
  156. * {
  157. * title: 'Tab 1',
  158. * html : 'A simple tab'
  159. * },
  160. * {
  161. * title: 'Tab 2',
  162. * html : 'Another one'
  163. * }
  164. * ],
  165. * renderTo : Ext.getBody()
  166. * });
  167. *
  168. * The {@link #setActiveTab} is a very useful method in TabPanel which will allow you to change the
  169. * current active tab. You can either give it an index or an instance of a tab. For example:
  170. *
  171. * @example
  172. * var tabs = Ext.create('Ext.tab.Panel', {
  173. * items: [
  174. * {
  175. * id : 'my-tab',
  176. * title: 'Tab 1',
  177. * html : 'A simple tab'
  178. * },
  179. * {
  180. * title: 'Tab 2',
  181. * html : 'Another one'
  182. * }
  183. * ],
  184. * renderTo : Ext.getBody()
  185. * });
  186. *
  187. * var tab = Ext.getCmp('my-tab');
  188. *
  189. * Ext.create('Ext.button.Button', {
  190. * renderTo: Ext.getBody(),
  191. * text : 'Select the first tab',
  192. * scope : this,
  193. * handler : function() {
  194. * tabs.setActiveTab(tab);
  195. * }
  196. * });
  197. *
  198. * Ext.create('Ext.button.Button', {
  199. * text : 'Select the second tab',
  200. * scope : this,
  201. * handler : function() {
  202. * tabs.setActiveTab(1);
  203. * },
  204. * renderTo : Ext.getBody()
  205. * });
  206. *
  207. * The {@link #getActiveTab} is a another useful method in TabPanel which will return the current active tab.
  208. *
  209. * @example
  210. * var tabs = Ext.create('Ext.tab.Panel', {
  211. * items: [
  212. * {
  213. * title: 'Tab 1',
  214. * html : 'A simple tab'
  215. * },
  216. * {
  217. * title: 'Tab 2',
  218. * html : 'Another one'
  219. * }
  220. * ],
  221. * renderTo : Ext.getBody()
  222. * });
  223. *
  224. * Ext.create('Ext.button.Button', {
  225. * text : 'Get active tab',
  226. * scope : this,
  227. * handler : function() {
  228. * var tab = tabs.getActiveTab();
  229. * alert('Current tab: ' + tab.title);
  230. * },
  231. * renderTo : Ext.getBody()
  232. * });
  233. *
  234. * Adding a new tab is very simple with a TabPanel. You simple call the {@link #method-add} method with an config
  235. * object for a panel.
  236. *
  237. * @example
  238. * var tabs = Ext.create('Ext.tab.Panel', {
  239. * items: [
  240. * {
  241. * title: 'Tab 1',
  242. * html : 'A simple tab'
  243. * },
  244. * {
  245. * title: 'Tab 2',
  246. * html : 'Another one'
  247. * }
  248. * ],
  249. * renderTo : Ext.getBody()
  250. * });
  251. *
  252. * Ext.create('Ext.button.Button', {
  253. * text : 'New tab',
  254. * scope : this,
  255. * handler : function() {
  256. * var tab = tabs.add({
  257. * // we use the tabs.items property to get the length of current items/tabs
  258. * title: 'Tab ' + (tabs.items.length + 1),
  259. * html : 'Another one'
  260. * });
  261. *
  262. * tabs.setActiveTab(tab);
  263. * },
  264. * renderTo : Ext.getBody()
  265. * });
  266. *
  267. * Additionally, removing a tab is very also simple with a TabPanel. You simple call the {@link #method-remove} method
  268. * with an config object for a panel.
  269. *
  270. * @example
  271. * var tabs = Ext.create('Ext.tab.Panel', {
  272. * items: [
  273. * {
  274. * title: 'Tab 1',
  275. * html : 'A simple tab'
  276. * },
  277. * {
  278. * id : 'remove-this-tab',
  279. * title: 'Tab 2',
  280. * html : 'Another one'
  281. * }
  282. * ],
  283. * renderTo : Ext.getBody()
  284. * });
  285. *
  286. * Ext.create('Ext.button.Button', {
  287. * text : 'Remove tab',
  288. * scope : this,
  289. * handler : function() {
  290. * var tab = Ext.getCmp('remove-this-tab');
  291. * tabs.remove(tab);
  292. * },
  293. * renderTo : Ext.getBody()
  294. * });
  295. */
  296. Ext.define('Ext.tab.Panel', {
  297. extend: 'Ext.panel.Panel',
  298. alias: 'widget.tabpanel',
  299. alternateClassName: ['Ext.TabPanel'],
  300. requires: ['Ext.layout.container.Card', 'Ext.tab.Bar'],
  301. <span id='Ext-tab-Panel-cfg-tabPosition'> /**
  302. </span> * @cfg {String} tabPosition
  303. * The position where the tab strip should be rendered. Can be `top` or `bottom`.
  304. */
  305. tabPosition : 'top',
  306. <span id='Ext-tab-Panel-cfg-activeItem'> /**
  307. </span> * @cfg {String/Number} activeItem
  308. * Doesn't apply for {@link Ext.tab.Panel TabPanel}, use {@link #activeTab} instead.
  309. */
  310. <span id='Ext-tab-Panel-cfg-activeTab'> /**
  311. </span> * @cfg {String/Number/Ext.Component} activeTab
  312. * The tab to activate initially. Either an ID, index or the tab component itself.
  313. */
  314. <span id='Ext-tab-Panel-cfg-tabBar'> /**
  315. </span> * @cfg {Object} tabBar
  316. * Optional configuration object for the internal {@link Ext.tab.Bar}.
  317. * If present, this is passed straight through to the TabBar's constructor
  318. */
  319. <span id='Ext-tab-Panel-cfg-layout'> /**
  320. </span> * @cfg {Object} layout
  321. * Optional configuration object for the internal {@link Ext.layout.container.Card card layout}.
  322. * If present, this is passed straight through to the layout's constructor
  323. */
  324. <span id='Ext-tab-Panel-cfg-removePanelHeader'> /**
  325. </span> * @cfg {Boolean} removePanelHeader
  326. * True to instruct each Panel added to the TabContainer to not render its header element.
  327. * This is to ensure that the title of the panel does not appear twice.
  328. */
  329. removePanelHeader: true,
  330. <span id='Ext-tab-Panel-cfg-plain'> /**
  331. </span> * @cfg {Boolean} plain
  332. * True to not show the full background on the TabBar.
  333. */
  334. plain: false,
  335. <span id='Ext-tab-Panel-cfg-itemCls'> /**
  336. </span> * @cfg {String} [itemCls='x-tabpanel-child']
  337. * The class added to each child item of this TabPanel.
  338. */
  339. itemCls: Ext.baseCSSPrefix + 'tabpanel-child',
  340. <span id='Ext-tab-Panel-cfg-minTabWidth'> /**
  341. </span> * @cfg {Number} minTabWidth
  342. * The minimum width for a tab in the {@link #cfg-tabBar}.
  343. */
  344. minTabWidth: undefined,
  345. <span id='Ext-tab-Panel-cfg-maxTabWidth'> /**
  346. </span> * @cfg {Number} maxTabWidth The maximum width for each tab.
  347. */
  348. maxTabWidth: undefined,
  349. <span id='Ext-tab-Panel-cfg-deferredRender'> /**
  350. </span> * @cfg {Boolean} deferredRender
  351. *
  352. * True by default to defer the rendering of child {@link Ext.container.Container#cfg-items items} to the browsers DOM
  353. * until a tab is activated. False will render all contained {@link Ext.container.Container#cfg-items items} as soon as
  354. * the {@link Ext.layout.container.Card layout} is rendered. If there is a significant amount of content or a lot of
  355. * heavy controls being rendered into panels that are not displayed by default, setting this to true might improve
  356. * performance.
  357. *
  358. * The deferredRender property is internally passed to the layout manager for TabPanels ({@link
  359. * Ext.layout.container.Card}) as its {@link Ext.layout.container.Card#deferredRender} configuration value.
  360. *
  361. * **Note**: leaving deferredRender as true means that the content within an unactivated tab will not be available
  362. */
  363. deferredRender : true,
  364. //inherit docs
  365. initComponent: function() {
  366. var me = this,
  367. dockedItems = [].concat(me.dockedItems || []),
  368. activeTab = me.activeTab || (me.activeTab = 0);
  369. // Configure the layout with our deferredRender, and with our activeTeb
  370. me.layout = new Ext.layout.container.Card(Ext.apply({
  371. owner: me,
  372. deferredRender: me.deferredRender,
  373. itemCls: me.itemCls,
  374. activeItem: me.activeTab
  375. }, me.layout));
  376. <span id='Ext-tab-Panel-property-tabBar'> /**
  377. </span> * @property {Ext.tab.Bar} tabBar Internal reference to the docked TabBar
  378. */
  379. me.tabBar = new Ext.tab.Bar(Ext.apply({
  380. dock: me.tabPosition,
  381. plain: me.plain,
  382. border: me.border,
  383. cardLayout: me.layout,
  384. tabPanel: me
  385. }, me.tabBar));
  386. dockedItems.push(me.tabBar);
  387. me.dockedItems = dockedItems;
  388. me.addEvents(
  389. <span id='Ext-tab-Panel-event-beforetabchange'> /**
  390. </span> * @event
  391. * Fires before a tab change (activated by {@link #setActiveTab}). Return false in any listener to cancel
  392. * the tabchange
  393. * @param {Ext.tab.Panel} tabPanel The TabPanel
  394. * @param {Ext.Component} newCard The card that is about to be activated
  395. * @param {Ext.Component} oldCard The card that is currently active
  396. */
  397. 'beforetabchange',
  398. <span id='Ext-tab-Panel-event-tabchange'> /**
  399. </span> * @event
  400. * Fires when a new tab has been activated (activated by {@link #setActiveTab}).
  401. * @param {Ext.tab.Panel} tabPanel The TabPanel
  402. * @param {Ext.Component} newCard The newly activated item
  403. * @param {Ext.Component} oldCard The previously active item
  404. */
  405. 'tabchange'
  406. );
  407. me.callParent(arguments);
  408. // We have to convert the numeric index/string ID config into its component reference
  409. me.activeTab = me.getComponent(activeTab);
  410. // Ensure that the active child's tab is rendered in the active UI state
  411. if (me.activeTab) {
  412. me.activeTab.tab.activate(true);
  413. // So that it knows what to deactivate in subsequent tab changes
  414. me.tabBar.activeTab = me.activeTab.tab;
  415. }
  416. },
  417. <span id='Ext-tab-Panel-method-setActiveTab'> /**
  418. </span> * Makes the given card active. Makes it the visible card in the TabPanel's CardLayout and highlights the Tab.
  419. * @param {String/Number/Ext.Component} card The card to make active. Either an ID, index or the component itself.
  420. * @return {Ext.Component} The resulting active child Component. The call may have been vetoed, or otherwise
  421. * modified by an event listener.
  422. */
  423. setActiveTab: function(card) {
  424. var me = this,
  425. previous;
  426. card = me.getComponent(card);
  427. if (card) {
  428. previous = me.getActiveTab();
  429. if (previous !== card &amp;&amp; me.fireEvent('beforetabchange', me, card, previous) === false) {
  430. return false;
  431. }
  432. // We may be passed a config object, so add it.
  433. // Without doing a layout!
  434. if (!card.isComponent) {
  435. Ext.suspendLayouts();
  436. card = me.add(card);
  437. Ext.resumeLayouts();
  438. }
  439. // MUST set the activeTab first so that the machinery which listens for show doesn't
  440. // think that the show is &quot;driving&quot; the activation and attempt to recurse into here.
  441. me.activeTab = card;
  442. // Attempt to switch to the requested card. Suspend layouts because if that was successful
  443. // we have to also update the active tab in the tab bar which is another layout operation
  444. // and we must coalesce them.
  445. Ext.suspendLayouts();
  446. me.layout.setActiveItem(card);
  447. // Read the result of the card layout. Events dear boy, events!
  448. card = me.activeTab = me.layout.getActiveItem();
  449. // Card switch was not vetoed by an event listener
  450. if (card &amp;&amp; card !== previous) {
  451. // Update the active tab in the tab bar and resume layouts.
  452. me.tabBar.setActiveTab(card.tab);
  453. Ext.resumeLayouts(true);
  454. // previous will be undefined or this.activeTab at instantiation
  455. if (previous !== card) {
  456. me.fireEvent('tabchange', me, card, previous);
  457. }
  458. }
  459. // Card switch was vetoed by an event listener. Resume layouts (Nothing should have changed on a veto).
  460. else {
  461. Ext.resumeLayouts(true);
  462. }
  463. return card;
  464. }
  465. },
  466. <span id='Ext-tab-Panel-method-getActiveTab'> /**
  467. </span> * Returns the item that is currently active inside this TabPanel.
  468. * @return {Ext.Component} The currently active item.
  469. */
  470. getActiveTab: function() {
  471. var me = this,
  472. // Ensure the calculated result references a Component
  473. result = me.getComponent(me.activeTab);
  474. // Sanitize the result in case the active tab is no longer there.
  475. if (result &amp;&amp; me.items.indexOf(result) != -1) {
  476. me.activeTab = result;
  477. } else {
  478. me.activeTab = null;
  479. }
  480. return me.activeTab;
  481. },
  482. <span id='Ext-tab-Panel-method-getTabBar'> /**
  483. </span> * Returns the {@link Ext.tab.Bar} currently used in this TabPanel
  484. * @return {Ext.tab.Bar} The TabBar
  485. */
  486. getTabBar: function() {
  487. return this.tabBar;
  488. },
  489. <span id='Ext-tab-Panel-method-onAdd'> /**
  490. </span> * @protected
  491. * Makes sure we have a Tab for each item added to the TabPanel
  492. */
  493. onAdd: function(item, index) {
  494. var me = this,
  495. cfg = item.tabConfig || {},
  496. defaultConfig = {
  497. xtype: 'tab',
  498. card: item,
  499. disabled: item.disabled,
  500. closable: item.closable,
  501. hidden: item.hidden &amp;&amp; !item.hiddenByLayout, // only hide if it wasn't hidden by the layout itself
  502. tooltip: item.tooltip,
  503. tabBar: me.tabBar,
  504. closeText: item.closeText
  505. };
  506. cfg = Ext.applyIf(cfg, defaultConfig);
  507. // Create the correspondiong tab in the tab bar
  508. item.tab = me.tabBar.insert(index, cfg);
  509. item.on({
  510. scope : me,
  511. enable: me.onItemEnable,
  512. disable: me.onItemDisable,
  513. beforeshow: me.onItemBeforeShow,
  514. iconchange: me.onItemIconChange,
  515. iconclschange: me.onItemIconClsChange,
  516. titlechange: me.onItemTitleChange
  517. });
  518. if (item.isPanel) {
  519. if (me.removePanelHeader) {
  520. if (item.rendered) {
  521. if (item.header) {
  522. item.header.hide();
  523. }
  524. } else {
  525. item.header = false;
  526. }
  527. }
  528. if (item.isPanel &amp;&amp; me.border) {
  529. item.setBorder(false);
  530. }
  531. }
  532. },
  533. <span id='Ext-tab-Panel-method-onItemEnable'> /**
  534. </span> * @private
  535. * Enable corresponding tab when item is enabled.
  536. */
  537. onItemEnable: function(item){
  538. item.tab.enable();
  539. },
  540. <span id='Ext-tab-Panel-method-onItemDisable'> /**
  541. </span> * @private
  542. * Disable corresponding tab when item is enabled.
  543. */
  544. onItemDisable: function(item){
  545. item.tab.disable();
  546. },
  547. <span id='Ext-tab-Panel-method-onItemBeforeShow'> /**
  548. </span> * @private
  549. * Sets activeTab before item is shown.
  550. */
  551. onItemBeforeShow: function(item) {
  552. if (item !== this.activeTab) {
  553. this.setActiveTab(item);
  554. return false;
  555. }
  556. },
  557. <span id='Ext-tab-Panel-method-onItemIconChange'> /**
  558. </span> * @private
  559. * Update the tab icon when panel icon has been set or changed.
  560. */
  561. onItemIconChange: function(item, newIcon) {
  562. item.tab.setIcon(newIcon);
  563. },
  564. <span id='Ext-tab-Panel-method-onItemIconClsChange'> /**
  565. </span> * @private
  566. * Update the tab iconCls when panel iconCls has been set or changed.
  567. */
  568. onItemIconClsChange: function(item, newIconCls) {
  569. item.tab.setIconCls(newIconCls);
  570. },
  571. <span id='Ext-tab-Panel-method-onItemTitleChange'> /**
  572. </span> * @private
  573. * Update the tab title when panel title has been set or changed.
  574. */
  575. onItemTitleChange: function(item, newTitle) {
  576. item.tab.setText(newTitle);
  577. },
  578. <span id='Ext-tab-Panel-method-doRemove'> /**
  579. </span> * @private
  580. * Unlink the removed child item from its (@link Ext.tab.Tab Tab}.
  581. *
  582. * If we're removing the currently active tab, activate the nearest one. The item is removed when we call super,
  583. * so we can do preprocessing before then to find the card's index
  584. */
  585. doRemove: function(item, autoDestroy) {
  586. var me = this,
  587. toActivate;
  588. // Destroying, or removing the last item, nothing to activate
  589. if (me.destroying || me.items.getCount() == 1) {
  590. me.activeTab = null;
  591. }
  592. // Ask the TabBar which tab to activate next.
  593. // Set the active child panel using the index of that tab
  594. else if ((toActivate = me.tabBar.items.indexOf(me.tabBar.findNextActivatable(item.tab))) !== -1) {
  595. me.setActiveTab(toActivate);
  596. }
  597. this.callParent(arguments);
  598. // Remove the two references
  599. delete item.tab.card;
  600. delete item.tab;
  601. },
  602. <span id='Ext-tab-Panel-method-onRemove'> /**
  603. </span> * @private
  604. * Makes sure we remove the corresponding Tab when an item is removed
  605. */
  606. onRemove: function(item, destroying) {
  607. var me = this;
  608. item.un({
  609. scope : me,
  610. enable: me.onItemEnable,
  611. disable: me.onItemDisable,
  612. beforeshow: me.onItemBeforeShow
  613. });
  614. if (!me.destroying &amp;&amp; item.tab.ownerCt === me.tabBar) {
  615. me.tabBar.remove(item.tab);
  616. }
  617. }
  618. });
  619. </pre>
  620. </body>
  621. </html>