tabbar + tabbar...parent addTab

I have a tabbar (Home), which content is a PHP script:

[code]

[/code] The PHP script includes a button that allow me to add new tabs which contents are other PHP scripts in the main tabbar (Home): [code] echo "New Contract
br>"; [/code] The NewContract PHP script includes a new button and another tabbar with two tabs into the main one (Home), which content are other PHP scripts: [code] echo "New Contract
br>";
tabbarContract = new dhtmlXTabBar('a_tabbar', 'top'); tabbarContract.setSkin('default'); tabbarContract.setImagePath('dhtmlxSuite/dhtmlxTabbar/codebase/imgs_personal/'); tabbarContract.enableTabCloseButton(false); tabbarContract.addTab('a1', '  Contract Information  ', '*'); tabbarContract.addTab('a2', '  Provided Services  ', '*'); tabbarContract.setHrefMode('iframes-on-demand'); tabbarContract.setTabActive('a1');
    tabbarContract.setContentHref('a1', 'http://localhost/Contract/Information.php?ContrattoID=<? echo $ContractID; ?>');
    tabbarContract.setContentHref('a2', 'http://localhost/Contract/Services.php?ContractID=<? echo $ContractID; ?>');
</script>
[/code]

The function add1(); doesn’t add new tabs in the Home tabbar.
I hope the following two images help to show well what I mean…

Please…help me!!!




IDs must be unique in a component. In your samples both add() and add1() functions add tabs with -1 id.

Try to use different ids to solve the problem:

<script> function add1() { var id = (new Date).valueOf(); parent.tabbarHome.addTab(id , 'Contract', '*'); parent.tabbarHome.setContentHref(id, 'NewContract.php'); parent.tabbarHome.setTabActive(id); } </script>

I tried that…but nothing changes…

I think the problem is where I need to add the new tab

:imp:

In both functions use tha same url ‘NewContract.php’.

I’ve attached the sample
02.zip (34.6 KB)

I don’t understand your sample.

I tried to change the content PHP file the button should open…but it doesn’t work.

The real code is more complicated than the example of this post, if you want I can attach all the filed involved (the PHP script connect often with a DB)

Sample shows that the new tab created on button click. Another tabbar inside the iframe can not affect this functionality.

You may provide the complete demo (without any server-side please) to make the issue clearer.

so what I would like to do is impossible?
:astonished:

Have I written that something is impossible ?

I just don’t understand the issue completely. For this reason I’ve asked to provide the complete sample.

Sorry…I misunderstood!

I try to explain better what I’d like to do.

As you can see in the first image, attached in the first message, I have a tabbar (called “Home”) with one tab (“Elenco Contratti”); its content is a PHP file that include a button (the one with the lens) and a datagrid; when I select a row in the datagrid and then I click on the button - or when I double-click on a row - I add a new tab with more information related to the selected row in the “Home” tabbar (“Contratto Comune di castelnuovo Val di Cecina” shown in the second attached image).

I do that (select a row and click on the button, not the double-click on a row) with this code:

[code]
button:
image

script:
function add2(pos,PaginaDaCaricare,NomeTab) {
var id = (new Date()).valueOf();
parent.tabbarHome.addTab(id, NomeTab+’    ‘, ‘*’);
parent.tabbarHome.setContentHref(id, PaginaDaCaricare);
parent.tabbarHome.setTabActive(id);
}
function ApriFunzione(idContratto,NomeContratto,PaginaDaCaricare,NomeTab) {
if (NomeTab == “Visualizza Contratto”) {
NomeTab = “Contratto”;
}
add2(-1,’’+PaginaDaCaricare+’.php?idContratto=’+idContratto+’&NomeContratto=’+NomeContratto,NomeTab+’ '+NomeContratto);
}[/code]

The content of this tab (as shown in the second image) is a PHP file that include a new tabbar (called “Contratto”) with seven tabs (in the second image you can see the “Always-on flat” tab); the content of such tab is another PHP file that include another button (the one with the lens in the second image) and another datagrid.

Here is the problem: I’d like to select a row and then click on this button - or to double-click on a row - and add a new tab in the “Home” tabbar.

I hope to have clarify any doubt and you can help me!

Thanks

Actually, it doesn’t matter whether grid is inside tab or not.
I’ve changed my previous sample. Hope it’ll help.

If the problem isn’t resolved, I need the complete demo (without the server-side scripts as I wrote before).
02.zip (34.6 KB)

I don’t understand your sample…I expected the button in order to add new tab in the “Home” tabbar

Links call addTab method of the tabbarHome.

my button links to the “Home” tabbar too:

function add2(idServizio) { var id = (new Date()).valueOf(); parent.tabbarHome.addTab(id, 'Visualizza Servizio&nbsp;&nbsp;&nbsp;&nbsp;', '*'); parent.tabbarHome.setContentHref(id, 'VisualizzaServizio.php?idServizio='+idServizio); parent.tabbarHome.setTabActive(id); }
but it doesn’t work :frowning:

I think the problem is that there is a tabbar into a tabbar…and clicking on a button in the internal tab, I can’t add a new tab in the external tabbar

I have attached a really explicit sample so you can understand my problem.

If I click on the New Contract (Home) link everything works well and I can add a new tab in the Home tabbar; but if I click on the New Contract (Contracts) link a new tab in the Home tabbar is not added.
03.zip (34.8 KB)

add1() function is called from an iframe that is inside another iframe. Therefore, you need to use the following:

<script> function add1() { var id = (new Date).valueOf(); parent.parent.tabbarHome.addTab(id , 'new tab', '*'); parent.parent.tabbarHome.setTabActive(id); } </script>

or

function add1() { parent.add(); }

I’ll got crazy soon if I don’t solve this problem.

Why my attached files don’t work as expected???

HELP ME PLEASE :cry:
06.zip (168 KB)

I’ve attached the worikng demo
06.zip (169 KB)