Printing tab contents

Hi

I am trying to print contents of all the tabs within the framework.
I have not found and answer in the forum and have not found a way to extract the tab contents via the api.

I have looked into the structure of tabs and have created this simplistic test routine, which extracts the tabs and prints them as required.

function printTabs(){

var iWin=document.getElementById('printit').contentWindow;
var iDoc = iWin.document;
iDoc.open();

var tab=document.getElementById('tab_bar');
var tab_titles = tab.childNodes[0].childNodes[0].childNodes[0];
var tab_contents = tab.childNodes[0].childNodes[1];
var tab_count = tab_contents.childElementCount;

for(var i=0; i < tab_count;i++){
	var title = tab_titles.childNodes[i].innerHTML
	var content = tab_contents.childNodes[i].innerHTML
	iDoc.write("<h1>" + title + "</h1>\n");
	iDoc.write(content);
	iDoc.write("<div style='page-break-after:always;'>&nbsp;</div>");

}
iDoc.close();
iWin.print();

}

My question are
a) Is there an api call which I have missed which allows be to step through the tabs getting the title and contents
b) is it safe to delve within the structure as I assume that there is no guarantee that it will remain constant between versions.
c) has anyone found an easier way using dhtmlx api standards to do this.
d) are there any flaws in my assumptions???

I have 2 sites which use dhtmlx, one still in 2.6 (it will get upgraded eventually) and one in 3.0.

Many thanks.

Hi
There is a method getAllTabs() from v.3.6 to iterate the tabs.
docs.dhtmlx.com/doku.php?id=dhtm … getalltabs
But there is no public method to get tab’s content.

Hi

Thanks for the reply.

I looked at getAllTabs in the project using version 3 (well 3.6 really) but could not see a way to delve down to the content.
The test routine works, but I’m not keen to use undocumented structures, but will have to and just keep an eye on version changes to see if any changes are needed.

Can I make a request for a getTabContent() function in a subsequent release.

Hi
We will consider this functionality. But it is not popular. Moreover, you are the first who asked about it :slight_smile:
if you need a public solution, you can get content using document.getElementById method. It will be possible if you put the content into a div with a certain id (div id can be the same as tab id for example). And this div is attached/loaded in a tab.

Hi

If it counts, I also need a getTabContent() function.
I have many forms, each one attached to a different tab, and I want to validate/submit the form of the last active tab when I switch to a new tab.

Meanwhile I’ll try the div/tab solution.

Thanks

Hi drkshrk
There is also a method getActiveTab() to det id of active tab. You can trace your tab-contant based on its id.

Hi Darya

I’ll try the method you mentioned. :smiley:

Thanks