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.
Datatables.js is a nice Js plugin library with various extensions that will allow you to make your ordinary HTML or AHTML reports better and more usable in a mobile setting.
Not sure if this is still needed with DataTables.js only. Did the header this way due to Tablesaw.js not working with headers. Haven't tested DataTables.js only though yet. If it still throws fits, this is the solution. :-) Also, for your reports, you can have your's dynamically populate using !IBI.AMP.xxx variables if you'd like, but if not, take those out of my code example so your reports will still work.
Here is my -HTMLFORM block for implementing DataTables.js. It has Search, sorting, pagination, styling abilities, etc. all built in. Way nicer than jigsaw/sander (tablesaw) or footable.js. Better long term support and community too.
Just plug the above block into the bottom of any of your report fexes, but inspect the page source first to see what class your table was given and your total row's and the following empty row's td tags were given and switch out any instances above of .x1 with your table class, and any instances of .x5/.x6 with your total row td tag class generated or what class the following empty row was given. The .x5 and .x6 classes are for getting rid of the extra blank row that generates at the end of your report if you choose/don't choose a total row to be included. Was having troubles with total rows in tablesaw.js so that was why this was implemented. Not sure if total rows are chill now with just datatables.js. Need to check! haha
Things to note:
You'll need to modify the columnDefs.type targets with the right number of indexes specific to your report(s) if you want sorting to work. Columns are 0 indexed.
Also, setting sScrollXInner to something larger that 100% will cause reports to crash on iOS browsers. Also, I don't have the fixed columns currently working in iOS either yet. Additionally, to get horizontal scrolling to work on Android for reports with fixed columns, you have to use 2 fingers to scroll.
Any questions, let me know!
Insta-make any of your HTML or AHTML reports far better than they were... lol
8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
Posts: 1113 | Location: USA | Registered: January 27, 2015
Before adding this to your report, did you find what class gets tied to your table tag element via inspecting the page source?
Does your report try to use a total line? If so, don't for now. Comment it out.
How many visible columns are in your report? Ensure the columnDefs.type property/option array of targets only has that many numbers specified based on how many columns, but starting with 0. Or better yet, comment that out for now.
Within your list of options, do you have commas after each option declaration?
Can you share your -HTMLFORM block with me, so I can help you troubleshoot it?
8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
Posts: 1113 | Location: USA | Registered: January 27, 2015
I'm looking at my page source, and I don't see a class getting assigned to my table. I do see x1 getting assigned to a TD tag. When I run the report I'm getting a warning about non-table initialization TD and SPAN, so I don't think I'm getting initialized properly.
Very nice, thanks. By the way, I figured out what I was doing wrong - I had a webfocus page heading on there that I should have removed. It was confusing the jquery I think.
This works great and is a lot easier to use than "footable".
I've got one problem left - I turned on the paging option, which is great, but I realized that it's counting my column headings as a row in the count, making the record count 1 greater than it should be. Not a deal-breaker, but I can see getting questions from users about it.
I had the same issue at one point where the paging record count was off by one. I can't remember what I did that ended up fixing it, but I think it either has something to do with the extra row it generates at the bottom of your report for some odd reason. For that, I added a CSS rule that said whatever class assigned that row to not display it.
(display: none;)
That either fixed it, or it had something to do with correct lengthMenu option params. I think those were off somehow, and that may have fixed it. If you set pageLength to something, that something has to be a value set within the lengthMenu arrays for things to work correctly.
Here's my current settings for the content I've applied this plugin to:
K, great! Glad you found a fix. Love your alternative solution. Should have thought of that. I was in a inspect-the-output mentality and didn't think of doing it that way at the time. haha
8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
Posts: 1113 | Location: USA | Registered: January 27, 2015
Added some of Mike's and CoolGuy's recent suggestions to my 7-March sample code...
-* File datatables01.fex
TABLE FILE CAR
PRINT SALES/I9C
CAR
BY MODEL
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET DROPBLNKLINE ON
ON TABLE NOTOTAL
ON TABLE HOLD AS DATATABL FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = warm, $
ENDSTYLE
END
-HTMLFORM BEGIN
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css">
<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.0.min.js">
</script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js">
</script>
<style>
.title {
font-size: 26px;
text-shadow: none;
font-weight: bold;
text-align: center;
font-family: Trebuchet MS;
}
#datatable1 {
font-family: Trebuchet MS;
}
</style>
-*
<script type=text/javascript charset=utf-8>
$(document).ready(function() {
$("#datatable1 table:eq(0)").attr("id", "cars"); //assign an id to the table generated by the focexec
$('#cars tr').last().remove(); //remove the last blank empty row.
$("#cars tr:eq(0)").wrap("<thead></thead>"); //dataTables requires <thead> tags around the headers
$('#cars').dataTable({ //initialize the Data Table.
"scrollY": true,
"scrollX": true,
"sScrollXInner": "100%",
"scrollCollapse": true,
"responsive": true,
"lengthChange": true
});
});
</script>
</head>
<body>
<div class="title">
Sales by Model
</div>
<div id="datatable1">
!IBI.FIL.DATATABL;
</div>
</body>
</html>
-HTMLFORM END