If you have multiple collapsible regions in a page which shows couple of reports. It will be a nice user experience to show a report collapsed if there is no records to show and expanded if there is any records to show. We can achieve it by using simple JQuery code.
I will show for a single classic report, you can apply the same for multiple reports
Step-1
Create a classic report set the Template as Collapsible and specify a static ID ( this will help to identify the report)
Step-2
Under report attributes specify a message when there is no records returned as below.
Step-3
Now add the following JQuery code in "Execute when Page Loads" section of the page.
jQuery(document).ready(function() {
if ($('.nodatafound', '#RPT1').length) {
$("#RPT1").removeClass('is-expanded').addClass('is-collapsed');
} else {
$("#RPT1").removeClass('is-collapsed').addClass('is-expanded');
}
});
Comments
Post a Comment