You can see this in a useful example in the Apex World Dashboard. Select a country and look at the ranking table.
In Oracle Apex you can implement such formatting in your query, using a PL/SQL function. This solution has several disadadvantages:
- Column header sorting is impossible because the actual numbers are replace by a character representation
- Calling a PL/SQL function in a query can degrade performance
- the readability of your query gets less
The formatting is implemented in a After Refresh DA on the report in question:
format_numbers_in_table('#report_tablespaces .t-Report-report');The function formats all the cells with numeric content.
The parameter to the function should be the selector to the HTML table containing the data to be formatted. In this case the UT Standard Region and Standard Report are used with a static ID tablespaces.
If the report contains a large number of columns or some columns should not be formatted the columns to be formatted can be limited by passing an array of column names as the second parameter:
format_numbers_in_table('#report_tablespaces .t-Report-report',['LAND_SURFACE','POPULATION']);Only the mentioned columns will be formatted.
Store the JavaScript functions on the page or seperately in a file. You can download the code here: Happy Apexing
No comments:
Post a Comment