Tabbar hide-show problem

I see this problem only in the newer version 4.0 prof of the dhtmlxsuite;

I create a simple tabbar

            objTabBar=objWindow.attachTabbar({ tabs: [] });
            objTabBar.addTab("key1","testo1","120px");
            objTabBar.addTab("key2","testo2","120px");

afterwards there is some logic activating or disactivating tabs
so there is

            objTabBar.tabs("key1").show();
            objTabBar.tabs("key2").show();

both tabs are correctly visible

            objTabBar.tabs("key1").hide();

first tab disappears: correct!

            objTabBar.tabs("key1").show();

*** first tab is not visible after reactivating! ***

command has changed from previous version, but documentation states, we should call “show”;
why doesn’t it work as expected?
thanks!

Hi

works fine locally. please provide browser details?

I’m seeing what seems to be the same issue, but when I try to put together a demo showing the problem, the problem doesn’t occur. Still trying to work out what’s different between our application and my demo.

Leonardo, were you able to resolve this?

no, wasn’t able to solve; I’ll put a (not working) example on the page these next days

Ok… hopefully you have more success with getting your demo to not work than I am.

I’ve debugged a bit into my application, and it looks like the tabs aren’t getting displayed because there’s a flag that’s gotten stuck on true - conf.transActv. From what I can tell, this is supposed to indicate if the tab is in the process of being hidden/shown, so that the component doesn’t trip over itself trying to do more than one thing to a tab at a time. Unfortunately at some point, this flag never gets set back to false, and so the tabbar component mistakenly thinks it needs to ignore the show() call because a hide() call is still in progress. I’m still not sure why this happens in my application but not in my demo, however.

Ok, I still don’t know what’s causing this, but I’ve found a solution nonetheless.

Running this snippet below after your dhtmlx.js import - but BEFORE you create any tabbar components - should disable the transitions that I believe are causing the problem. Your tabbar won’t look as swishy and cool as it’s supposed to, but at least it’ll work the way you expect it to.

window.dhx4.transDetect = function(){ 
	this.transData = { 
			transProp: false, 
			transEv : null
	};
	return this.transData;
};

wonderful, thanks! I’ll try it!

your solution works very well; but maybe it’s time to solve it in a more generic way, correcting the js; knowing dhx-guys are reading these notes, I’ll try to explain the problem in a more detailed way; I just downloaded the actual version - 2/3 version after the problem was told - and the problem is still there;
here’s a brief explaination

*) container

*) creating empty tabbar
objTabBar = new dhtmlXTabBar
({
parent: “desktop”,
arrows_mode: “auto”,
tabs:
[ ]
});

*) function which hides all existing tabs, and then shows the ones to activate;
if a tab’s not present, it creates it the first time

  function ShowButtons(goTabs)
  {
    actualTabs=objTabBar.getAllTabs();
    for (i=0; i<actualTabs.length; i++) 
    {
      objTabBar.tabs(actualTabs[i]).hide();
    }
    thisArray=goTabs.split(',')
    for (i=0;i<thisArray.length;i++)
    {
      idx=actualTabs.indexOf(thisArray[i]);
      if (idx<0)
      {
        objTabBar.addTab(thisArray[i],thisArray[i]);
      }
      objTabBar.tabs(thisArray[i]).show();
    }
  }
  • and now the problematic thing:
    • if I call this function the first time, it works well
    • if I call this function (with other parameters) a second time, it may work or it may not work
    • if I call this function a third time, I’m pretty sure it won’t work anymore

    when I say “it doesn’t work” I don’t mean there’s a js-error or something special: it simply
    doesn’t show each tab it should

so calling this function
ShowButtons(“prodotti”)
ShowButtons(“prodotti,emissioni,inserisci”)
ShowButtons(“prodotti,emissioni,dettaglio,professioni,assicurati,uscita,storico,pf,az”)

the tabbar should show only the tabs which are parameters of the last call of the function;
but it won’t! most of the time it doesn’t show the first or the first two tabs at all
(at this moment - the third call - both of them are already existing and should just be
shown)

is there a more elegant solution than the one stated?
thanks!!!

:slight_smile:

please try attached
83.ZIP (382 KB)

it works perfectly! I suppose this is not the last version of the js, as it seems a little smaller than the one we have; should we just wait the next official release in which this correction will be present? thank you very much in the meantime!

this is patched 4.1.3 std

also you can:

  1. use it
  2. wait for official update
  3. open ticket, I will add changes directly to your used version

ok, thank you …
we use professional version, so we will wait for the next official update;
thank you very much!