PDA

View Full Version : Timed Tabs



zmarsh
5 Mar 2008, 8:12 PM
I was wondering if extjs has the ability to advance between tabs with a given time variable, any help on this would be great! :)

evant
5 Mar 2008, 8:24 PM
DelayedTask (http://extjs.com/deploy/ext-2.0.2/docs/?class=Ext.util.DelayedTask) and activate (http://extjs.com/deploy/ext-2.0.2/docs/?class=Ext.TabPanel&member=activate) should do it for you.

zmarsh
5 Mar 2008, 10:34 PM
<?php

$random_tab = rand(0,12);

?>

<script type="text/javascript">
Ext.onReady(function(){
// basic tabs 1, built from existing content
var tabs = new Ext.TabPanel({
renderTo: 'tabs1',
width:890,
height:250,
activeTab: <?php echo $random_tab; ?>,
frame:false,
defaults:{autoHeight: false},
items:[

{contentEl:'news_tab', title: 'News'},
{contentEl:'photos_tab', title: 'Photos'},
{contentEl:'dining_tab', title: 'Dining'},
{contentEl:'nightlife_tab', title: 'Night Life'},
{contentEl:'music_tab', title: 'Music'},
{contentEl:'movies_tab', title: 'Movies'},
{contentEl:'culture_tab', title: 'Culture'},
{contentEl:'resortsandcasinos_tab', title: 'Resorts & Casinos'},
{contentEl:'lodging_tab', title: 'Lodging'},
{contentEl:'recreation_tab', title: 'Recreation'},
{contentEl:'sports_tab', title: 'Sports'},
{contentEl:'community_tab', title: 'Community'},
{contentEl:'blogs_tab', title: 'Blogs'}
]
});


});

So with the above code, how would I go about doing this to activate a new tab, does it need a new variable? I apologize, I am pretty new to javascript.

evant
5 Mar 2008, 10:42 PM
Give your TabPanel an id. You can then retrieve it using:



var tabs = Ext.getCmp('myTabs');