... but gets truncated on a mobile:
Here I'm using the APEX 5.0 Universal Theme, which at least adds a horizontal scrollbar to the report, but that isn't always ideal.
I came across a solution that I liked here which uses CSS alone to reformat the report vertically on small screens - like this:
Try my demo page at http://tiny.cc/apexrr (e.g. try it on your phone).
Having used this technique a couple of times I decided it would be worth wrapping up into a plug-in. After some deliberation I decided to make it a dynamic action plug-in, so that it can be added to apply the styling to a specified report region without having to manually add any CSS to the page. However, it is an unusual dynamic action because it doesn't actually do anything dynamic - the Javscript function it performs is a dummy that does nothing. The useful work is done by CSS that the plug-in adds to the page while rendering.
There are 3 settings for this plug-in - 2 at application level and 1 at component level:
- Application setting 1: CSS class of the report's container. This is normally a div that surrounds the whole report, which will have its width set to 100% on small screens by the plug-in.
- Application setting 2: CSS class of report data table. This is the table that contains just the report data (not the pagination etc.), which will be transformed by the plug-in.
- Component setting 1: Max screen width (px) affected This governs when the transformation kicks in - default is 760 (pixels).
My thinking (currently) is that the classes will be the same from region to region within the same applicaiton, as they come from the report template, whereas the screen width at which the report needs to be transformed could vary from one region to another.
When installing the plug-in you need to set the 2 application settings for the CSS classes appropriately for the report templates you are using.
To use the plug-in you need to create a dynamic action for each report region to which it needs to be applied as follows:
- Event: Page load
- Condition: none
- Action: this plug-in
- Max screen width (px) affected: as you wish (or leave as default)
- Selection type: Region
- Region: the region to apply it to
There are some limitations and caveats to be aware of:
- It only works on classic reports, not interactive reports. I'm not really sure it would make sense on IRs, and their HTML is different to that of classic reports.
- Column header sorting functionality is lost when the report is transformed for the small screen,
- The report headings must be enclosed in a element - you may need to edit your report template and add this (in the before/after column heading sections).
- The data table must have a class (to use in the component settings) - again, the report template can be edited if necessary.
If anyone cares to try it out and can give any feedback on how this could be improved I'd be glad to receive it - it will be available on apex-plugin.com very soon.