Problem with Iframe-Tabs (alert "false")

Helo everyone,

I have for example 2 tabs which include an iframe. The second tab have an other group of tabs (attached a tabbar) with other iframes.
Here is the code:

var mainLayout = new dhtmlXLayoutObject(document.body, '1C');
				var mainTabbar = mainLayout.cells("a").attachTabbar();
				mainTabbar.setImagePath("dhtmlx/imgs/");
//                mainTabbar.setSkin('dhx_skyblue');
                mainTabbar.setHrefMode("iframe");
                
                // Reiter: "Telefonliste"
				mainTabbar.addTab('tabEmployees','Telefonliste','');
                mainTabbar.setContentHref("tabEmployees","employees/index.php");
                mainTabbar.setTabActive('tabEmployees');

			// Reiter: "Drucker & Kartuschen"
				mainTabbar.addTab('tabPrinterdetails','Drucker & Kartuschen','200');
				var tabPrinterdetails = mainTabbar.cells('tabPrinterdetails');
				var tabbarPrinterdetails = tabPrinterdetails.attachTabbar();
                tabbarPrinterdetails.setImagePath("dhtmlx/imgs/");;
                tabbarPrinterdetails.setHrefMode("iframe");
				
				//** Unter-Reiter: "Druckerliste"
				tabbarPrinterdetails.addTab('tabPrinterlist','Druckerliste','');
                tabbarPrinterdetails.setContentHref("tabPrinterlist", "printerlist/index.php");
				tabbarPrinterdetails.setTabActive('tabPrinterlist');
				
				//** Unter-Reiter: "Kartuschenliste"
				tabbarPrinterdetails.addTab('tabCartList','Kartuschenliste','');
				tabbarPrinterdetails.setContentHref("tabCartList", "cart-list/index.php");
                
				//** Unter-Reiter: "Inventar"
				tabbarPrinterdetails.addTab('tabCaInventory','Kartuscheninventar','');
				tabbarPrinterdetails.setContentHref("tabCaInventory", "cart-inventory/index.php");

The problem is very strange. At the first view the complete solution works fine. But if I change the tab (on the frontend) from 2 to 1 and then from 1 to 2 were the content blank and I only see the alert “false” instead of the iframes, but the first tab works fine at this moment.

Have anyone an idea?

Hello
You have ‘iframe’ mode. It assumes that in content zone will be iframe.
But you use the attachTabbar() method.
The best way is using cells ("").attachURL. Delete this: mainTabbar.setHrefMode (“iframe”);

Hi Darya (again :slight_smile:),

thank you for your quickly help. Your result is better than mine.
But I realy dont unterstand, why the use of iframes in tabs so strongly and with so different result than with cells although both of them includes php-content-files :stuck_out_tongue:

How else, it works better with attachURL and I’m grateful to you!

THX

You are welcome :slight_smile:

Hey, Darya, one question:
Can I configurate the tabbar, that it remember the last state of the open tab?

I realy dont find a parameter which realisize this funktion.

There is an event, which gets this parameter - prevId:
tabbar.attachEvent(“onSelect”, function(id,prevId) { … });
Just set this parameter as a global variable.

I.e. something like this:

tabbar.attachEvent("onSelect", function(id,prevId) { tabbar.setLabel(id,"Active tab", 180); if (prevId) tabbar.setLabel(prevId,"Tab", 180); return true; });

I copied your code, but without any result.
Ich dont know, what I doing wrong:

dhtmlx.image_path='dhtmlx/imgs/';

				var mainLayout = new dhtmlXLayoutObject(document.body, '1C');
				var mainTabbar = mainLayout.cells("a").attachTabbar();
                mainTabbar.setSkin("default");
//                mainTabbar.setSkinColors("#00917B","#00917B");
                mainTabbar.attachEvent("onSelect", function(id,prevId) {
                    mainTabbar.setLabel(id,"Active tab", 180);
                    if (prevId)
                          mainTabbar.setLabel(prevId,"Tab", 180);
                    return true;
                 });
                
                // Reiter: "Telefonliste"
				mainTabbar.addTab('tabEmployees','Telefonliste','');
                mainTabbar.cells("tabEmployees").attachURL("employees/index.php");
                mainTabbar.setTabActive('tabEmployees');

Here is a working sample for you. Try to do by analogy and don’t forget to make your previous tab a global one.
tabbar.rar (286 KB)

Ok, I now noticed, that if I change the main-tabs, the names of the tabs have been renamed. The one tab has the name "“Active tab” and the other only “Tab”, like the names in the new codeblock

It was just sample :slight_smile: Sorry, what it is not so close to your case… :blush:

I dont know, if you understand me, what I mean.
If an user navigate in the tabbar and has for example the tab3 open. Then he refreshes the complete website and the last opened tab is always on top.

Could I realisize this solution with dhtmlx?

So, in this case: save active tab id (getActiveTab method) in cookies and after reload of the page restore this id and set active (setTabActive method).

Yeah ok, thank you again :wink:

You are welcome :slight_smile: