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.
Any hints for WebFocus report with JavaSciprt table sort? In other words: Running webfocus once and then (by clicking title-text) sorting a list/table without webfocus? There's a lot of javascipt-function in net(sortable.js etc), but how to adopt them easily as a part of webfocus-reporting? Our reports are in htmltable-format. One problem is the reserved word 'table'.
APP HOLD lidholh FILEDEF HOLD2 hold2.htm -* Please note that it should be javascript: and () instead of javascriptx and <> TABLE FILE CAR PRINT COUNTRY AS '<A href="javascriptx:sortTable<1>;">Country</A>' BY CAR AS '<A href="javascriptx:sortTable<0>;">Car</A>' ON TABLE HOLD FORMAT HTMTABLE END -RUN -READ HOLD, &LINE -* -* Replacing the first line of the table with the following line, the name rsTable and the number of cols is needed -WRITE HOLD2 <TABLE BORDER CELLPADDING=1 name="rsTable" id=rsTable cols=2> -:read -READ HOLD, &LINE -IF &IORETURN NE 0 GOTO :end_read; -WRITE HOLD2 &LINE -GOTO :read -:end_read -RUN -* -:disp -HTMLFORM BEGIN your htmlcode here
I had to change the call from sortTable(col, tableToSort) to sortTable(col) since I put the the Javascript call in the column title and Focus converted that to a line break. Then I added the following line:
var tableToSort = rsTable;
end of head body !IBI.FIL.HOLD2; end of body end of html -HTMLFORM END
Posts: 319 | Location: Stockholm, Sweden | Registered: February 04, 2004
Thank's for the tip! I still have some problems with the JavaScript, but I'm sure it will work. The idea is clear. Write-command was the answer to my problem.
In WebFOCUS 7, the next release, there will be a built-in control to make any column sortable. Until then, the advice you are getting will help solve the immediate problem.
Another technique that may not be the most desirable in this situation but is useful for getting at elements of the html table that WebFOCUS doesn't expose follows:
It's best if you create a single pixel image (but you can use any image) and include it in the first column of the report as defined below (MY_MODEL). This is so you can leverage the "onload" event of the image but since you don't want the image to show up on the report you give it a zero height and width. If the image cannot be found or for any reason is not loaded, the onload event will not fire. The onload event (called "WalkUp(element)") will then walk up the DOM, in this case, to find the "TR" tag and modify it's onmouseover and onmouseout events. You could have it walk up to the "TABLE" tag if you desire. Copy the code below and run it in your environment. Then mouseover the lines in the report to see the effect. NOTE: If you don't have the "century_corp.gif" file in the directory as shown, change the path to any image that exists in your environment.
DEFINE FILE CAR MY_MODEL/A110 = '' || MODEL; END
TABLE FILE CAR PRINT MY_MODEL AS 'MODEL' BODYTYPE DEALER_COST RETAIL_COST ON TABLE HOLD AS CARFIL FORMAT HTMTABLE END
-HTMLFORM BEGIN
<script> var bgcolor = ""; function ChangeColor() { bgcolor = this.style.backgroundColor; this.style.backgroundColor = "orange"; }
function ChangeBack() { this.style.backgroundColor = bgcolor; }
function WalkUp(element) { while (true) { if (element.tagName == "TR") { break; } element = element.parentElement; } element.onmouseover = ChangeColor; element.onmouseout = ChangeBack; }
!IBI.FIL.CARFIL;
-HTMLFORM ENDThis message has been edited. Last edited by: <Mabel>,