The best way to load Content?

Hello,

I will build an Application with a Menu (Tree) leftside and on the rightside my content.
Both are inside a Layoutcontainer (cell a and b).
I added a Tabbar to my Content-Cell b.

Now I wan´t to load my Modules(HTML, Javascript-Code, … ??) after clicking in my Menu in seperate Tabs, but I do not know what is the best way to do this at all.

It would be best to load the code/content after clicking the menu item dynamicly, but I do not know how…
…or is there a better solution?

Thanks for your help,
Kai

Use the attachEvent method your tree on the left. Point it to a function aka create_tab(id). Define an object that will hold the ids of your tabs (do this at the top of your script). In the create_tab function, use the addTab method to add a new tab. Your menu should have an id by default, use that id to create a tab and store that id in your object you created earlier. You can check if a tab is already created by using if(objectVar[id]) { your code here } else { setTabActive(id) }

Thanks for your fast reply!

My question is still, “as I have to write the code”.

Finally, I want the tab content is loaded only, when I call the addTab-method.

The

  • tabbar.setContentHref(“calendar”,“my-content.php”)
    and load something it is not perfect, because I must include the dhtml.js & .css again in my my-content.php.

  • and the other ways I know, execute the code before I added into a Tab.

Thanks so much again for your solution!

I guess I don’t understand the question “as I have to write the code”.

lets say you do this:

app.tabbar.addTab(id,"My tab");

you can then use the method attachURL like so:

app.tabbar.cells(id).attachURL("path/to/file.php");

this will create an iFrame in which you can still access methods from the parent frame.
See: http://docs.dhtmlx.com/doku.php?id=dhtmlxlayout:urlattaching

Hope this helps.

On a side note, I am having problems with the whole iFrame experience right now and hoping to get an answer from the dhtmlx team.

calibraman
Yes, the simplest way is using attachURL() method

magicman

Where is your issue is described?

magicman
I’ve foud it :slight_smile: