PDA

View Full Version : TabBlink ExtJS 4.1.a



muceli
2 Feb 2013, 6:59 AM
I want to go off when I press the flash button will select the tab. I called my page, but I found a very old example. (TabBlink example) 4.1.a version of ExtJS does not work. Can you help?


There are two tabs at the same time I did, but the problem is flashing 2 crushing the previous tab in a tab



<script type="text/javascript">
Ext.onReady(function(){
var tabPanel = new Ext.TabPanel({
width: 700,
height: 150,
renderTo: Ext.getBody(),
activeTab: 0,
items: [{
title: 'Tab 1',
html: 'Tab1 ?šerik',
id: 'id1',
closable: true,
itemId: 't1'
}, {
title: 'Tab 2',
html: 'Tab2 ?šerik',
id: 'id2',
itemId: 't2'
}],
bbar: [{
text: 'Tab1 Blink',
handler: function () { tabPanel.blinkTab('id1','t1'); }
}, {
text: 'Tab2 Blink',
handler: function () { tabPanel.blinkTab('id2','t2'); }
}]
});
});
</script>


Js


var myTab;
var myIDTab;


Ext.override(Ext.TabPanel,{
blinkTab : function(tabId, tabItemId)
{
myIDTab = Ext.getCmp(tabId);
myTab = this.child('#' + tabItemId).tab;
if (!myTab || myTab._blinking) {
return;
}
myTab.blinkStat = false;
myTab.blinkCounter = 0;
myTab.blinkTask = setInterval("blinkIt();", 500);

myIDTab.on('click', stopBlink, this, { single: true });
if (myIDTab.el)
{
myIDTab.mon(myIDTab.el, 'click', stopBlink, this, { single: true });
}


myTab.on('click', stopBlink, this, { single: true });
if (myTab.el) {
myTab.mon(myTab.el, 'click', stopBlink, this, { single: true });
}
}
});


function blinkIt() {
if (myTab.blinkCounter > 4) {
myTab.addCls('a');
myTab.blinkCounter = 0;
clearInterval(myTab.blinkTask);
} else {
if (!myTab.blinkStat) {
myTab.blinkCounter++;
myTab.addCls('a');
myTab.blinkStat = true;
} else {
myTab.removeCls('a');
myTab.blinkStat = false;
}
}
}


function stopBlink() {
myTab.removeCls('a');
myTab.blinkStat = false;
myTab.blinkCounter = 0;
clearInterval(myTab.blinkTask);

myIDTab.un('activate', stopBlink, this);
if (myIDTab.el) {
myIDTab.mun(myIDTab.el, 'click', stopBlink, this);
}


myTab.un('activate', stopBlink, this);
if (myTab.el) {
myTab.mun(myTab.el, 'click', stopBlink, this);
}
}


css


.a{
background-image:url(tab-btm-right-bg.gif) !important;
}

muceli
2 Feb 2013, 7:02 AM
I tried to give a background image but it did not reach the tab element...

muceli
6 Feb 2013, 3:34 AM
There are two tabs at the same time I did, but the problem is flashing 2 crushing the previous tab in a tab



var myTab;
var myIDTab;


Ext.override(Ext.TabPanel,{
blinkTab : function(tabId, tabItemId)
{
myIDTab = Ext.getCmp(tabId);
myTab = this.child('#' + tabItemId).tab;
if (!myTab || myTab._blinking) {
return;
}
myTab.blinkStat = false;
myTab.blinkCounter = 0;
myTab.blinkTask = setInterval("blinkIt();", 500);

myIDTab.on('click', stopBlink, this, { single: true });
if (myIDTab.el)
{
myIDTab.mon(myIDTab.el, 'click', stopBlink, this, { single: true });
}


myTab.on('click', stopBlink, this, { single: true });
if (myTab.el) {
myTab.mon(myTab.el, 'click', stopBlink, this, { single: true });
}
}
});


function blinkIt() {
if (myTab.blinkCounter > 4) {
myTab.addCls('a');
myTab.blinkCounter = 0;
clearInterval(myTab.blinkTask);
} else {
if (!myTab.blinkStat) {
myTab.blinkCounter++;
myTab.addCls('a');
myTab.blinkStat = true;
} else {
myTab.removeCls('a');
myTab.blinkStat = false;
}
}
}


function stopBlink() {
myTab.removeCls('a');
myTab.blinkStat = false;
myTab.blinkCounter = 0;
clearInterval(myTab.blinkTask);

myIDTab.un('activate', stopBlink, this);
if (myIDTab.el) {
myIDTab.mun(myIDTab.el, 'click', stopBlink, this);
}


myTab.un('activate', stopBlink, this);
if (myTab.el) {
myTab.mun(myTab.el, 'click', stopBlink, this);
}
}