Focal Point
THEAD Tag [solved]

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6981087013

December 17, 2008, 09:58 AM
ChannyS
THEAD Tag [solved]
Is there a way to get WebFOCUS to put out THEAD tags on HTMTABLE format?

This message has been edited. Last edited by: ChannyS,


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
December 17, 2008, 11:27 AM
Francis Mariani
Wouldn't it be lovely? The answer is, unfortunately, WF does not create THEAD and TBODY tags. But you can fool it:

DEFINE FILE CAR
THEADS/A8 = '<THEAD>';
THEADE/A8 = '</THEAD>';
END
TABLE FILE CAR
PRINT
*
HEADING
"<THEADS"
"WEBFOCUS REPORT"
"<THEADE"
WHERE READLIMIT EQ 100
WHERE RECORDLIMIT EQ 100
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
FONT='ARIAL', SIZE=8, GRID=OFF, $
ENDSTYLE

ON TABLE HOLD AS H001 FORMAT HTMTABLE
END
-RUN

-HTMLFORM BEGIN
<STYLE>
THEAD { COLOR: RED; }
</STYLE>
!IBI.FIL.H001;
-HTMLFORM END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 17, 2008, 11:47 AM
ChannyS
Neat idea. I guess my needs are too different to make this work for me - I actually want my TH's which are generated for the Titles to be inside of the THEAD...


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
December 17, 2008, 12:32 PM
j.gross
Not quite so neat -- the THEAD and /THEAD tags will be inproperly nested: WF encloses each element of the HEADING a TD /TD pair. Standard browsers may not mind, but if the THEAD is needed for an accessibility agent, it may complain.

To include the column titles in the span of the THEAD, you could play with sticking the /THEAD in a conditional subhead, conditioned to appear only at top of page. That way, the column-title lines are sandwiched between the THEAD in the HEADING, and the /THEAD in the SUBHEAD. -- But you'll still have the improper nesting issue.


- Jack Gross
WF through 8.1.05
December 17, 2008, 12:49 PM
Francis Mariani
Sorry Jack.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 18, 2008, 08:47 AM
Lucas
Here is a sample on how to add THEAD's, TH's and what ever else you want to add to your table using javascript......

TABLE FILE CAR                                  
PRINT COUNTRY CAR MODEL
WHERE SEAT EQ 2
ON TABLE HOLD AS MYTHING FORMAT HTMTABLE
END 
-RUN                                                
-HTMLFORM BEGIN                                     
<HTML>                                              
<HEAD>                                              
<SCRIPT  LANGUAGE=JAVASCRIPT>                       
function header()
{                     
var doIt = document.getElementsByTagName("TR");
var fixedHTML = "<TABLE BORDER CELLPADDING=1>";
	for (var i = 0; i < doIt.length; i++)
	{
		if (i)
		{
			if (new String(doIt[i].innerHTML).indexOf("<TD vAlign=bottom>") >= 0)
			{
			var theHTML = new String(doIt[2].innerHTML);
			var newHTML = theHTML.replace(/<TD vAlign=bottom>/g, "<TH>");
			newHTML = newHTML.replace(/<\/TD>/g, "</TH>");
			fixedHTML += "<THEAD><TR>"+newHTML+"</TR></THEAD>";
			}
			else if (new String(doIt[i].innerHTML).indexOf("PAGE 1") >= 0) fixedHTML += "";
			else fixedHTML += "<TR>"+doIt[i].innerHTML+"</TR>";
		}
	}
	fixedHTML += "</TABLE>";
document.getElementById("sample").innerHTML = fixedHTML;
}                                                   
</SCRIPT>                                           
</HEAD>                                             
<BODY onload="header()" id="sample">                                              
 !IBI.FIL.MYTHING;                                 
</BODY>                                             
</HTML>                                             



7.6.6 Mainframe
7.6.4 Web Focus
Windows

December 18, 2008, 09:26 AM
ChannyS
I ended up doing it the Javascript as well with the following snippet of code:
 
 var tHead = table.createTHead();
 var oTR = tHead.insertRow();
 var titles = table.getElementsByTagName('th');

 for(var x = 0; x < titles.length; x++)
 {
    var oTH = titles[x];
    oTR.appendChild(oTH);
 }
 table.deleteRow(1);

 



Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv