Focal Point
[CLOSED] Dynamically Resize & control the Division <Div>

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

September 21, 2009, 11:13 AM
richard weinbaum
[CLOSED] Dynamically Resize & control the Division <Div>
I'm displaying a WebFOCUS report created by ON TABLE HOLD FORMAT HTML in a Division. I have to dynamically resize and control the Division
. I have Javascipt code that does this but it requires that the Division have an ID parameter associated with it. WF does not include the ID parameter in the Division. Is there a way that I can create the ID using WF code at run time?

Example: WF provides this:



I want to create this:



Has anyone done this before? Thanks.

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


WF 7.7.3
Windows 2003 Server
PDF
HTML
EXL2k
Richard, please use
[code]
[/code]
tags around code and HTML you want to include in your posting.

How do you get WebFOCUS to generate "div" tags, it doesn't normally do so?


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
Francis -

my HTML file is created by
  
TABLE FILE....
.
.
ON TABLE HOLD FORMAT HTML
END


which creates

  
.
.
<DIV class='scrollDiv'>
.
.


I need the

  
.
.
<DIV> to include
.
.


id="theReport"

So the
would look something like this:

  
.
.
<DIV class='scrollDiv' id="theReport">
.
.



WF 7.7.3
Windows 2003 Server
PDF
HTML
EXL2k
Please illuminate me on how you got WebFOCUS to generate the
<DIV class='scrollDiv'>
tag. Did you create this report using a DevStudio GUI tool, if so, which one?


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
in all honesty i don't know other than to include the complete TABLE request. Here it is. Sorry for its length.
  
SET HTMLCSS = ON
SET ASNAMES=OFF
TABLE FILE HOLD51
PRINT ZZ_INDICATOR       AS 'Performance Indicator'
      INFOLOGO AS ' '
   ZUNIT_NAME AS 'Agency'
   LINK_ZZ_TARGET         AS 'YTD,Target'
      LINK_ZZ_ACUTAL         AS 'YTD,Actual'
      ZZ_ZPCT_CHANGE        AS 'Change,From,Target'
   LAST_DATA_MYR AS 'Data,Through'
      ZTREND_IND  NOPRINT
      TREND_IND  NOPRINT
   INDICATOR_SEQ NOPRINT
   UNIT_ID NOPRINT
-*----------------------------------------------------------------------------------------------------------------
BY TAG_NAME NOPRINT
BY ZPERSPECT_DISPLAY_ORDER NOPRINT
BY ZGOAL_DISPLAY_ORDER NOPRINT
BY ZGOAL AS 'Goal' NOPRINT
BY ZUNIT_DISPLAY_ORDER NOPRINT
 BY  MASTER_RPT_PRINT_ORDER  NOPRINT AS 'MSTR,PRINT,ORDER'
 BY  ZSORT                   NOPRINT AS 'ZSORT'
 BY  RPT_PRINT_ORDER         NOPRINT AS 'PRINT,ORDER'

WHERE ENDDATE_FLAG EQ 'X'

ON TAG_NAME SUBHEAD
 "<TAG_NAME"
ON ZGOAL SUBHEAD
 "<ZGOAL"
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS XYZ FORMAT HTML
ON TABLE SET STYLE *
     UNITS=IN,
     PAGESIZE='Letter',
     LEFTMARGIN=0.055556,
     RIGHTMARGIN=0.055556,
     TOPMARGIN=0.055556,
     BOTTOMMARGIN=0.125000,
     SQUEEZE=ON,
     ORIENTATION=LANDSCAPE,
$
TYPE=REPORT,FONT='ARIAL',GRID=ON,
$
TYPE=REPORT, HFREEZE=ON,SCROLLHEIGHT=4.5,
$
TYPE=HEADING,LINE=1,
    SIZE=12,STYLE=BOLD,
     JUSTIFY=CENTER,
$
TYPE=HEADING,LINE=2,
    SIZE=12,STYLE=BOLD,
     JUSTIFY=CENTER,
$
TYPE=HEADING,LINE=3,
    SIZE=8,STYLE=BOLD,FONT='ARIAL',JUSTIFY=CENTER,
$
TYPE=HEADING,LINE=4,
    SIZE=8,STYLE=BOLD,FONT='ARIAL',
$
TYPE=HEADING,LINE=5,
    SIZE=8,STYLE=BOLD,FONT='ARIAL',
$
TYPE=HEADING,LINE=6,
    SIZE=8,FONT='ARIAL',
$
TYPE=HEADING,LINE=7,
    SIZE=8,FONT='ARIAL',
$
TYPE=SUBHEAD,BY=TAG_NAME,
     LINE=1,
     FONT='ARIAL',SIZE=10,
     COLOR='WHITE',BACKCOLOR='BLACK',STYLE=BOLD,
     JUSTIFY=CENTER,
$
TYPE=SUBHEAD,BY=ZGOAL,
     LINE=1,
     FONT='ARIAL',SIZE=10,COLOR='BLACK',
     BACKCOLOR='SILVER',STYLE=BOLD,
     JUSTIFY=CENTER,
$
TYPE=TITLE,
     FONT='ARIAL',
     SIZE=8,COLOR='WHITE',BACKCOLOR='STEEL BLUE',
     STYLE=-UNDERLINE+BOLD,
     JUSTIFY=CENTER,
$
TYPE=REPORT,COLUMN=ZGOAL,
     FONT='ARIAL',SIZE=8,
     COLOR='STEEL BLUE',STYLE=BOLD,WRAP=1.500000,
$
TYPE=REPORT,COLUMN=ZZ_INDICATOR,
     HGRID=ON,VGRID=OFF,SIZE=8,STYLE=BOLD,
     WRAP=4.00000,WHEN=UNIT_ID EQ 'MTAHQ',
$
TYPE=REPORT,COLUMN=ZZ_INDICATOR,
     HGRID=ON,VGRID=OFF,SIZE=8,COLOR=RGB(80 80 80),
     WRAP=4.00000,WHEN=ZSORT EQ '3C',
$
TYPE=REPORT,COLUMN=ZZ_INDICATOR,
     HGRID=ON,VGRID=OFF,SIZE=8,
     WRAP=4.00000,
$
TYPE=REPORT,COLUMN=LAST_DATA_MYR,
     SIZE=8,WRAP=.600000,
  JUSTIFY=CENTER,
$
TYPE=REPORT,COLUMN=ZUNIT_NAME,
     SIZE=8,WRAP=0.800000,
 JUSTIFY=CENTER,
$
TYPE=REPORT,COLUMN=ZUNIT_NAME,
     SIZE=8,WRAP=0.800000,STYLE=BOLD,
 JUSTIFY=CENTER,WHEN=UNIT_ID EQ 'MTAHQ',
$
TYPE=REPORT,COLUMN=INFOLOGO,JUSTIFY=CENTER,
$
TYPE=REPORT,COLUMN=LINK_ZZ_ACUTAL,
     SIZE=8,WRAP=0.700000,HGRID=ON,VGRID=OFF,
  JUSTIFY=CENTER,BACKCOLOR='SILVER',
$
-*TYPE=REPORT,COLUMN=LINK_ZZ_ACUTAL,
-*     SIZE=8,WRAP=0.700000,
-*  JUSTIFY=CENTER,COLOR='WHITE',WHEN=LINK_ZZ_ACUTAL EQ 'X',
$
TYPE=REPORT,COLUMN=LINK_ZZ_TARGET,
     SIZE=8,WRAP=0.700000,BACKCOLOR='SILVER',
  JUSTIFY=CENTER,
$
TYPE=REPORT,COLUMN=ZZ_CURRENT_MTH_ACTUAL,
     SIZE=8,WRAP=0.700000,
  JUSTIFY=CENTER,
$
TYPE=REPORT,COLUMN=ZZ_ZPCT_CHANGE,
     SIZE=8,STYLE=BOLD,
     WRAP=.55000,
  JUSTIFY=CENTER,
$
TYPE=DATA,COLUMN=ZZ_ZPCT_CHANGE,
     BACKCOLOR = RGB(51 153 102) , WHEN=ZTREND_IND EQ 'POSITIVE',
     COLOR=WHITE,SIZE=8,WRAP=0.600000,
  JUSTIFY=CENTER,
$
TYPE=DATA,COLUMN=ZZ_ZPCT_CHANGE,
     BACKCOLOR = 'RED' , WHEN=ZTREND_IND EQ 'NEGATIVE',
     COLOR=WHITE,SIZE=8,WRAP=0.600000,
  JUSTIFY=CENTER,
$
TYPE=DATA,COLUMN=ZZ_ZPCT_CHANGE,
     BACKCOLOR = 'YELLOW' , WHEN=ZTREND_IND EQ 'NEUTRAL',
     SIZE=8,WRAP=0.600000,
  JUSTIFY=CENTER,
$
TYPE=DATA,COLUMN=ZZ_ZPCT_CHANGE,
     BACKCOLOR = 'WHITE' , WHEN=ZTREND_IND EQ 'BLANK',
     SIZE=8,WRAP=0.600000,
  JUSTIFY=CENTER,
$
TYPE=DATA,COLUMN=ZZ_ZPCT_CHANGE,
     BACKCOLOR = 'WHITE' , WHEN=ZTREND_IND EQ 'NOCOLOR',
     SIZE=8,WRAP=0.600000,
  JUSTIFY=CENTER,
$

ENDSTYLE
ON TABLE SET NODATA ' '
END




WF 7.7.3
Windows 2003 Server
PDF
HTML
EXL2k
Francis HFREEZE=ON is what creates the DIVs

Richard you are going to have to modify your Javascript

Try using getElementsByTagName this will return an array,
look at the code to check it index of the div tag you want,
probably 0 and using that you should be able to give it an id.

This message has been edited. Last edited by: <JG>,
Yes, the reports are long and need to keep the headings and column titles fixed at the top of the screen so I used HFREEZE. So does anyone know how I can name the DIVs so the JAVASCRIPT that I have to resize the Divs will work?

Thanks.


WF 7.7.3
Windows 2003 Server
PDF
HTML
EXL2k
Sorry Richard I was just editing when you beat me with your reply
As JG mentions, you could try getElementsByTagName.

E.g.:
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
    'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>

<html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml:lang='en'>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<script type='text/javascript'>
function resizeDiv1()
{
document.getElementsByTagName('DIV')[0].style.height = 150;
}
</script>

<style type='text/css'>
div { border: 1px solid black; }
</style>

<title> test </title>
</head>

<body onload="resizeDiv1();">

<div>1 aaa<br />1 bbb<br />1 ccc<br /></div>
<div>2 aaa<br />2 bbb<br />2 ccc<br /></div>
<div>3 aaa<br />3 bbb<br />3 ccc<br /></div>
</body>
</html>


For some reason, this does not work in Firefox.


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
quote:
getElementsByTagName

There are several well documented differences between IE and FireFox using this method
WebFOCUS example:

TABLE FILE CAR
SUM
SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
BY LENGTH

ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS XYZ FORMAT HTML

ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', GRID=ON, $
TYPE=REPORT, HFREEZE=ON, SCROLLHEIGHT=4.5, $
END
-RUN

-HTMLFORM BEGIN
!IBI.FIL.XYZ;

<script type='text/javascript'>
document.getElementsByTagName('DIV')[1].style.height = 350;
document.getElementsByTagName('DIV')[1].style.overflow = 'auto';
</script>

-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
francis - the issue with your last post is doesn't the htmlform begin statement cause the report to be displayed?

my issue is that WF is NOT displaying any of the content that I create with it. I am creating a host of htm files using WF and then deploying them to another of my web servers that knows nothing about WF. It is from this web server that all the content that i've created is displayed.


WF 7.7.3
Windows 2003 Server
PDF
HTML
EXL2k
Then you need to adjust your source javascript
Richard,

I'm only trying to help, but if you do not provide all the information up front my assistance can't be very effective...

If you're creating a host of html files (not evident in your original posting), how are you putting them together on the other server?


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
Use the ON TABLE HOLD FORMAT HTMTABLE instead, then use an AJAX call to retrieve the file and insert it into the DIV tag.

Fex
TABLE FILE CAR
SUM
     SALES
BY COUNTRY
ON TABLE HOLD AS baseapp/my_report FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
$
ENDSTYLE
END
 


HTML to call it
<html>
     <head>
          <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
          <script type="text/javascript" src="/approot/baseapp/js/prototype-1.6.1.0.js" ></script>
          <script>
               window.onload = function() {
                    new Ajax.Updater('myReport', '/approot/baseapp/my_report.htm');
               }
          </script>
     </head>
     <body >
          <div id="myReport"></div>
     </body>
</html>  

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


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
quote:
HFREEZE

It's not supported for htmtable
quote:
prototype-1.6.1.0.js
Darryl,

You're quoting that third party framework again when a lot of shops will not permit downloads of this type (short-sighted maybe), so your solution (albeit a very good method) won't suit everyone Frowner

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
Tony,

Yes, I realize that not everyone will be able to use a third party JS framework. In my client base, that number is getting lower every day.

That being said, although my examples still use it, it does not take away from the root of the potential solution. For those that do not have a framework, there are still plenty of examples on the web - and in this forum - of AJAX calls without a framework. If the example makes sense, then a solution is an hour of research away. I personally think it talks to this post a wee bit!

Later

p.s. did anyone notice that the latest version of PMF actually comes bundled with this very same framework?


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
thank you all for your help and advice.


WF 7.7.3
Windows 2003 Server
PDF
HTML
EXL2k