Disable a tab : TabPanel « Ext JS « JavaScript DHTML






Disable a tab

  
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
<!-- Revised from Ext JS Library 3.0.0 --> 
<html>
<head>
<title>Hello World Window</title>
<link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
    <!-- Tabs Example Files -->
    <style type="text/css">
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
.list {list-style:square;width:500px;padding-left:16px;}
.list li{padding:2px;font-size:8pt;}

pre {
   font-size:11px; 
}

.x-tab-panel-body .x-panel-body {
    padding:10px;
}

/* default loading indicator for ajax calls */
.loading-indicator {
  font-size:8pt;
  background-image:url('ext-3.0.0/resources/images/default/grid/loading.gif');
  background-repeat: no-repeat;
  background-position: left;
  padding-left:20px;
}

.new-tab {
    background-image:url('ext-3.0.0/examples/feed-viewer/images/new_tab.gif) !important;
}


.tabs {
    background-image:url(ext-3.0.0/examples/desktop/images/tabs.gif ) !important;
}    
    </style>
    <script type="text/javascript">
/*!
 * Ext JS Library 3.0.0
 * Copyright(c) 2006-2009 Ext JS, LLC
 * licensing@extjs.com
 * http://www.extjs.com/license
 */
Ext.onReady(function(){
    // basic tabs 1, built from existing content
    var tabs = new Ext.TabPanel({
        renderTo: 'tabs1',
        width:450,
        activeTab: 0,
        frame:true,
        defaults:{autoHeight: true},
        items:[
            {contentEl:'script', title: 'Short Text'},
            {contentEl:'markup', title: 'Long Text'}
        ]
    });

    // second tabs built from JS
    var tabs2 = new Ext.TabPanel({
        renderTo: document.body,
        activeTab: 0,
        width:600,
        height:250,
        plain:true,
        defaults:{autoScroll: true},
        items:[{
                title: 'Normal Tab',
                html: "My content was added during construction."
            },{
                title: 'Ajax Tab 1',
                autoLoad:'ajax1.htm'
            },{
                title: 'Ajax Tab 2',
                autoLoad: {url: 'ajax2.htm', params: 'foo=bar&wtf=1'}
            },{
                title: 'Event Tab',
                listeners: {activate: handleActivate},
                html: "I am tab 4's content. I also have an event listener attached."
            },{
                title: 'Disabled Tab',
                disabled:true,
                html: "Can't see me cause I'm disabled"
            }
        ]
    });

    function handleActivate(tab){
        alert(tab.title + ' was activated.');
    }
});    
    </script>
</head>
<body>
<h1>Tab Panel Examples</h1>
<p>Note that the js and css is not minified so it is readable. See <a href="tabs-example.js">tabs-example.js</a> for the tab creation code
and <a href="tabs-example.css">tabs-example.css</a> for the css.</p>

    <h3>Tabs with auto height that resize to the content. Built from existing markup.</h3><br>

    <!-- container for the existing markup tabs -->
    <div id="tabs1">
        <div id="script" class="x-hide-display">
            <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus.<br/><br/> Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.</p>
        </div>
        <div id="markup" class="x-hide-display">
            <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.<br/><br/>Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit.</p>
        </div>
    </div>

    <br>
    <h3>Tabs with no tab strip and a fixed height that scroll the content. Built entirely with javascript.</h3>
    <ul class="list">
    <li>Tab 1 is a normal tab with content passed when adding it.</li>
    <li>Tab 2 is loaded via Ajax.</li>
    <li>Tab 3 is loaded via Ajax too. It was set up to pass parameters when loaded.</li>
    <li>Tab 4 has an event listener attached.</li>
    <li>Tab 5 is disabled.</li>
    </ul><br>


</body>
</html>

   
    
  








Related examples in the same category

1.Add tab panel to a window
2.Hold tab panel in a window
3.Closable tab panel
4.Disabled tab
5.Embedded Tab Panel
6.Border layout tab panel
7.Enable tab scroll
8.Set tab resizble to true
9.Set minimum tab width
10.Indicate active tab index
11.Add tab to tab panel
12.Add gear and help icon to tab header
13.Create tab, add to tab panel and then add tab panel to a FormPanel
14.Add html editor to tab panel
15.Forms can be a TabPanel
16.Set activeTab for TabPanel
17.Grouping tab
18.Nested tab
19.Tab change event
20.Place TabPanel in a ViewPort
21.Scrollable tabs with a tabscroller menu
22.Tabs with auto height that resize to the content. Built from existing markup.
23.Tabs with no tab strip and a fixed height that scroll the content. Built entirely with javascript.
24.Tab activated event