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     [RESOLVED] Need help with dynamic javascript sort on HTMTABLE within iframe

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[RESOLVED] Need help with dynamic javascript sort on HTMTABLE within iframe
 Login/Join
 
Silver Member
posted
Looking for some help from some WF gurus on how I might be able to get data within an iframe to be dynamically sorted (using referenced .js file) when the column header is clicked. I have the .js file ready. What I am having trouble with is referencing the output that is in the iframe.

I believe i have to "chain" these to make it work. Googling on the web found this snippit but I can't seem to get this to work:

var tables = document.getElementById('iframecontent').getElementsByClassName('sortable');

Any ideas? Has anyone been able to get this to work? Any sample FOCUS code you could share would be much appreciated.

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


Linux x86
Apache
Excel, CSV, HTML, PDF
 
Posts: 31 | Registered: September 29, 2010Report This Post
Expert
posted Hide Post
You're asking a non-WebFOCUS question here.

Are you using prototype.js?

Are you sure your iframe has an id of "iframecontent"? If you're using IE, are you sure getElementsByClassName works in IE? Have you looked at the source of the iframe - do the html elements you want to sort have the class "sortable"?

Perhaps not what you're looking for, this is a quickie WebFOCUS solution to sorting table rows by clicking on column titles:

-*-- sortdemo1.fex - Francis Mariani -------------------------------------------

-SET &ECHO=ALL;

-DEFAULT &SORT     = 'COUNTRY';
-DEFAULT &PREVSORT = 'COUNTRY';
-DEFAULT &SORTDIR  = 'HIGEST';

-SET &SORTDIR  = IF &SORT EQ &PREVSORT AND &SORTDIR EQ 'LOWEST' THEN 'HIGHEST' ELSE 'LOWEST';
-SET &DIRCOLOR = IF &SORTDIR EQ 'LOWEST' THEN 'RED' ELSE 'GREEN';

-*-SET &RNDM = EDIT(HHMMSS('A8'),'99$99$99');

TABLE FILE CAR
PRINT
COUNTRY
CAR
MODEL
SALES

BY &SORTDIR &SORT NOPRINT

ON TABLE SET PAGE NOLEAD

ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF,FONT='ARIAL', SIZE=8, $

TYPE=TITLE, STYLE=BOLD, $
TYPE=TITLE, COLUMN=&SORT(2), COLOR=&DIRCOLOR,$

TYPE=TITLE, COLUMN=P1, FOCEXEC=SORTDEMO1( \
SORT='COUNTRY' \
PREVSORT='&SORT' \
SORTDIR='&SORTDIR' \
-*RNDM=&RNDM \
), $

TYPE=TITLE, COLUMN=P2, FOCEXEC=SORTDEMO1( \
SORT='CAR' \
PREVSORT='&SORT' \
SORTDIR='&SORTDIR' \
-*RNDM=&RNDM \
), $

TYPE=TITLE, COLUMN=P3, FOCEXEC=SORTDEMO1( \
SORT='MODEL' \
PREVSORT='&SORT' \
SORTDIR='&SORTDIR' \
-*RNDM=&RNDM \
), $

TYPE=TITLE, COLUMN=P4, FOCEXEC=SORTDEMO1( \
SORT='SALES' \
PREVSORT='&SORT' \
SORTDIR='&SORTDIR' \
-*RNDM=&RNDM \
), $

ENDSTYLE
END
-RUN


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
Silver Member
posted Hide Post
"Are you sure your iframe has an id of "iframecontent"?" No, this was generic. I replaced this with my iframe name.

"If you're using IE, are you sure getElementsByClassName works in IE?" Yes, it works.

"Have you looked at the source of the iframe - do the html elements you want to sort have the class "sortable"?" Yes, I added the sortable class to the iframe element


Thanks Francis. This at least got me on the right track.


Linux x86
Apache
Excel, CSV, HTML, PDF
 
Posts: 31 | Registered: September 29, 2010Report This Post
Expert
posted Hide Post
kadkins, good news, but how did you resolve it?

Cheers,


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
Silver Member
posted Hide Post
There was some bad coding in the external .js file. Once I corrected that, it worked fine.

Also, the output for the .fex MUST be in HTMTABLE format for it to work. Standard HTML did not work form me when troubleshooting.

Thanks again for the FOCUS example.


Linux x86
Apache
Excel, CSV, HTML, PDF
 
Posts: 31 | Registered: September 29, 2010Report 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     [RESOLVED] Need help with dynamic javascript sort on HTMTABLE within iframe

Copyright © 1996-2020 Information Builders