Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] collapse/expand columns in an html report

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] collapse/expand columns in an html report
 Login/Join
 
<JG>
posted
I seem to remember several posts requesting a method how to do this.

Have a play.

 
TABLE FILE CAR
PRINT
  COMPUTE '<A onClick="javascript:hide_column(2,2);">Profit<sup>+/-</sup></A>'/D20=RCOST - DCOST;
     DCOST
     RCOST
     SEATS
  COMPUTE '<A onClick="javascript:hide_column(6,2);">Profit 2<sup>*</sup></A>'/D20=RCOST - DCOST;
     DCOST
     RCOST
BY COUNTRY
ON TABLE SET PAGE NOPAGE
ON TABLE HOLD AS CARREP FORMAT HTMTABLE
END
-RUN
-HTMLFORM BEGIN
<html>
<head>
<script>
function initial_hide(hidecols) {
    var cols = hidecols;
    var tbl  = document.getElementsByTagName('TABLE');
    var rows = document.getElementsByTagName('TR');

    for (var row=0; row<rows.length;row++) {
      var cels = rows[row].getElementsByTagName('TD')

	for(i=0; i<cols.length; i++) {
	x=cols[i];
    cels[x].style.display='none';
   }
}
}
function hide_column(col_no,howmany) {
    var stl;
	var whichcol = col_no;
	var celsty;
    var tbl  = document.getElementsByTagName('TABLE');
    var rows = document.getElementsByTagName('TR');

    for (var row=0; row<rows.length;row++) {
      var cels = rows[row].getElementsByTagName('TD')
	  var lastcol = whichcol + howmany ;

    for (var i=whichcol; i<lastcol;i++){
	      celsty = cels[i].style.display;

	      if (celsty=='none') stl = ''; else stl = 'none';
          cels[i].style.display=stl;
	  }
    }
  }
</script>

</head>
<body onLoad="initial_hide([2,3,6,7]);">
!IBI.FIL.CARREP;
</body>
-HTMLFORM END



edited to change 'block' to '' so that it works in both IE and Firefox

This message has been edited. Last edited by: Kerry,
 
Report This Post
Expert
posted Hide Post
quote:
collapse/expand columns in an html report

Nice!


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Very nice!
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Platinum Member
posted Hide Post
Hi JG,
thats, very nice!! Is it possible to collapse rows in a form,(like a datagrid) so that the user can fill the rows if nessecary!!

Regards

Christian


WF Production Version: 7.7.02M
WF Test Version: 7.7.02M
Developer Studio: 7.7.02
HTML, EXL2K, FLEX, PDF,PPT
 
Posts: 156 | Location: Essen Germany | Registered: December 02, 2010Report This Post
<JG>
posted
An enhanced version

It changes to background color of the clicked cell when it is expanded or clapsed
and has a mouseover displaying show/hide as appropriate.


 
TABLE FILE CAR
PRINT
     COMPUTE '<A onClick="hide_column(2,2);">Profit</A>'/D20=RCOST - DCOST;
     DCOST
	 RCOST
	 SEATS
	 COMPUTE '<A onClick="hide_column(6,2);">Profit 2</A>'/D20=RCOST - DCOST;
     DCOST
	 RCOST
BY COUNTRY
ON TABLE SET PAGE NOPAGE
ON TABLE HOLD AS CARREP FORMAT HTMTABLE
END
-RUN
-HTMLFORM BEGIN
<html>
<head>
<script>
function initial_hide(linkcols,hidecols) {
var links = linkcols;
var cols = hidecols;
var tbl  = document.getElementsByTagName('TABLE');
var rows = document.getElementsByTagName('TR');
 
var cels = rows[0].getElementsByTagName('TD');
 
 for(i=0; i<links.length; i++) {
 var x=links[i];
 cels[x].style.backgroundColor = 'red';
 cels[x].style.cursor = 'pointer' ;
 cels[x].title="show"
}
 
for (var row=0; row<rows.length;row++) {
var cels = rows[row].getElementsByTagName('TD');
 
 for(i=0; i<cols.length; i++) {
 x=cols[i];
 cels[x].style.display='none';
 
}
}
}
function hide_column(col_no,howmany) {
 var stl;
 var celcol;
 var whichcol = col_no;
 var celsty;
 var celtit;
 
var tbl  = document.getElementsByTagName('TABLE');
var rows = document.getElementsByTagName('TR'); 
var cel0 = rows[0].getElementsByTagName('TD');

 celcol = cel0[whichcol -1].style.backgroundColor;
 if (celcol=='red') {
       celcol = 'green';
    celtit = 'hide';
    }
  else if(celcol=='green') {
       celcol = 'red';
    celtit = 'show';
    }
else {
     celcol = '';
    celtit = '';
 }
 cel0[whichcol -1].style.backgroundColor = celcol;
 cel0[whichcol -1].title=celtit;

for (var row=0; row<rows.length;row++) {
var cels = rows[row].getElementsByTagName('TD')
   var lastcol = whichcol + howmany ;
 
 
for (var i=whichcol; i<lastcol;i++){
       celsty = cels[i].style.display;
if (celsty=='none') stl = ''; else stl = 'none';
       cels[i].style.display=stl;
   }
}
}
</script>

</head>
<body onLoad="initial_hide([1,5],[2,3,6,7]);">
!IBI.FIL.CARREP;
</body>
-HTMLFORM END
 


Edited to add the pointer cursor as suggested by Waz

This message has been edited. Last edited by: <JG>,
 
Report This Post
Platinum Member
posted Hide Post
That's pretty cool. Thanks JG!


prod:7.6.9, win2k3 mre, caster, bid, devstudio 7.6.9
 
Posts: 242 | Location: Minneapolis | Registered: February 16, 2006Report This Post
<JG>
posted
Thanks, for the kind responses.

Christian, yes you can do it on a row basis for a 'data grid'.

It will take different javascript and how complex that needs to be depends
on is it a single input grid or a grid based on a BY field meaning you have blocks.

WebFOCUS generates strange HTML dependant on the Styling options you use.
 
Report This Post
Expert
posted Hide Post
Don't stop there, perhaps you could finalise the script and sell it to IBI.

Big Grin

Good One

I'm saving a copy of this to my Examples APP directrory.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
By adding
 cels[x].style.cursor = 'pointer' ;
to the initial_hide function, the title will have a hand cursor.

Tried it in IE6, Chrome, Firefox and Safari, and all worked.

Awesome.

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


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
<JG>
posted
quote:
cels[x].style.cursor = 'pointer' ;

Thanks Waz, good suggestion. I've added it to the posted code.

This message has been edited. Last edited by: <JG>,
 
Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] collapse/expand columns in an html report

Copyright © 1996-2020 Information Builders