Login Register

How can I open a new tab by clicking on a button ???

Hello !

Juste one question( before the following ;) ) about Tab.Container :
is it possible to open a new tab by clicking on a form button ?

I explain : I want to use dijit.Dialog to open an authentification box. So, by clicking on "OK", it open a new closable tab with my authentification test code. I also need to use GET or POST to pass infos to the tab...

But I need to know how to open a new tab. I tried to use visibility:hidden... but I'm a newbie in dojo and javascript so...

Please Help !!! ;)

thanks

if you tabContainer has

if you tabContainer has id="foo" ...

dojo.connect(dijit.byId("button"),"onClick",function(e){

    var newTab = new dijit.layout.ContentPane({ title:"a new tab" });
    dijit.byId("foo").addChild(newTab);
    dijit.byId("foo").selectChild(newTab);

});

Thanks... (again ;) )

Thanks... (again ;) )

So I must declare this in , and how can I apply this to my button ?

bye

edited for tags

The code inside the connect

The code inside the connect could be substituted for your dijit.form.Button's onClick method ...

So must I use your code as

So must I use your code as following ? (this doesn't works...) :

<button ID="button" dojoType="dijit.form.Button">open new tab</button>

thanks again

pleaaaaaaaaaaaaaaase ;)

pleaaaaaaaaaaaaaaase ;)

Dante ?? Could you please

Dante ??

Could you please explain me how to use your code ?

Thanks,

RE: Could you please

//This associates an event handler to the "onClick" event of "button"
dojo.connect(dijit.byId("button"),"onClick",function(e){

    //This creates a new tab object
    var newTab = new dijit.layout.ContentPane({ title:"a new tab" });
    //This associates the new tab to "foo"
    dijit.byId("foo").addChild(newTab);
    //This selects the tab you have just created
    dijit.byId("foo").selectChild(newTab);

});

Hope this helps, and thank you to Dante for providing this handy code in the first place.

Thanks !!

Thanks for all, but where can I use it in my code ??? It must be declared between HEAD and HEAD ?
And how can I mention the "closable" var for my tab ???

;)