Skip to Main Content

There are some rows in the report - woohoo

Javascript, executed on Select List Change - non-working version

async function refreshDashboard() {
   // refresh the Report
   apex.region("my_report").refresh();

   console.log('Refreshing Report (1)');

   return 'something';
}

async function titleChange() {
   // Chane title of the Report
    if ($("#my_report #report_my_report").length){
        $("#my_report #my_report_heading").text("There are some rows in the report - woohoo");
    } else {
        $("#my_report #my_report_heading").text("Sorry, no rows to display");
    }

    console.log('Changing title (2)');

    return 'something';
}

async function changeTitles() {
    await refreshDashboard();
    await titleChange();
}

changeTitles(); 

Javascript, executed on Button click

// Chane title of the Report
if ($("#my_report #report_my_report").length){
   $("#my_report #my_report_heading").text("There are some rows in the report - woohoo");
} else {
   $("#my_report #my_report_heading").text("Sorry, no rows to display");
}

Javascript, executed on Select List Change - Working version

async function refreshDashboard() {
   console.log('Refreshing Report (1)');

   // return the refreshed Report so titleChange can work with it
   return apex.region("my_report").refresh();
}

async function titleChange() {
   // Chane title of the Report
    if ($("#my_report #report_my_report").length){
        $("#my_report #my_report_heading").text("There are some rows in the report - woohoo");
    } else {
        $("#my_report #my_report_heading").text("Sorry, no rows to display");
    }

    console.log('Changing title (2)');

    return 'Nothing to return. We are good here.';
}

async function changeTitles() { 
    await refreshDashboard();
    await titleChange();
}

changeTitles(); 

Javascript, executed on Button click

// Chane title of the Report
if ($("#my_report #report_my_report").length){
   $("#my_report #my_report_heading").text("There are some rows in the report - woohoo");
} else {
   $("#my_report #my_report_heading").text("Sorry, no rows to display");
}