X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/f5240829880f87e0cf581c6a296e436fdef0ef80..f562e4c6e5fac7bcb445985b99acbea4d706e6f0:/examples/tabs/tabs-adv.js?ds=inline
diff --git a/examples/tabs/tabs-adv.js b/examples/tabs/tabs-adv.js
index d8ef7abd..6015ff2c 100644
--- a/examples/tabs/tabs-adv.js
+++ b/examples/tabs/tabs-adv.js
@@ -1,41 +1,102 @@
-/*!
- * Ext JS Library 3.3.0
- * Copyright(c) 2006-2010 Ext JS, Inc.
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-Ext.onReady(function(){
-
- var tabs = new Ext.TabPanel({
- renderTo:'tabs',
- resizeTabs:true, // turn on tab resizing
- minTabWidth: 115,
- tabWidth:135,
- enableTabScroll:true,
- width:600,
- height:250,
- defaults: {autoScroll:true},
- plugins: new Ext.ux.TabCloseMenu()
+/*
+
+This file is part of Ext JS 4
+
+Copyright (c) 2011 Sencha Inc
+
+Contact: http://www.sencha.com/contact
+
+GNU General Public License Usage
+This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
+
+If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
+
+*/
+Ext.Loader.setConfig({enabled: true});
+
+Ext.Loader.setPath('Ext.ux', '../ux/');
+
+Ext.require([
+ 'Ext.tab.*',
+ 'Ext.ux.TabCloseMenu'
+]);
+
+Ext.onReady(function() {
+ var currentItem;
+ var tabs = Ext.createWidget('tabpanel', {
+ renderTo: 'tabs',
+ resizeTabs: true,
+ enableTabScroll: true,
+ width: 600,
+ height: 250,
+ defaults: {
+ autoScroll:true,
+ bodyPadding: 10
+ },
+ items: [{
+ title: 'Tab 1',
+ iconCls: 'tabs',
+ html: 'Tab Body
' + Ext.example.bogusMarkup,
+ closable: true
+ }],
+ plugins: Ext.create('Ext.ux.TabCloseMenu', {
+ extraItemsTail: [
+ '-',
+ {
+ text: 'Closable',
+ checked: true,
+ hideOnClick: true,
+ handler: function (item) {
+ currentItem.tab.setClosable(item.checked);
+ }
+ }
+ ],
+ listeners: {
+ aftermenu: function () {
+ currentItem = null;
+ },
+ beforemenu: function (menu, item) {
+ var menuitem = menu.child('*[text="Closable"]');
+ currentItem = item;
+ menuitem.setChecked(item.closable);
+ }
+ }
+ })
});
// tab generation code
var index = 0;
- while(index < 7){
- addTab();
+ while(index < 3){
+ addTab(index % 2);
}
- function addTab(){
+
+ function addTab (closable) {
+ ++index;
tabs.add({
- title: 'New Tab ' + (++index),
+ title: 'New Tab ' + index,
iconCls: 'tabs',
- html: 'Tab Body ' + (index) + '
'
- + Ext.example.bogusMarkup,
- closable:true
+ html: 'Tab Body ' + index + '
' + Ext.example.bogusMarkup,
+ closable: !!closable
}).show();
}
- new Ext.Button({
- text: 'Add Tab',
- handler: addTab,
+ Ext.createWidget('button', {
+ renderTo: 'addButtonCt',
+ text: 'Add Closable Tab',
+ handler: function () {
+ addTab(true);
+ },
iconCls:'new-tab'
- }).render(document.body, 'tabs');
-});
\ No newline at end of file
+ });
+
+ Ext.createWidget('button', {
+ renderTo: 'addButtonCt',
+ text: 'Add Unclosable Tab',
+ handler: function () {
+ addTab(false);
+ },
+ iconCls:'new-tab',
+ style: 'margin-left: 8px;'
+ });
+});
+