KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Help with subreport.update() #1600

Open stacy opened this topic on on Aug 27, 2020 - 2 comments

stacy commented on Aug 27, 2020

Hi, I try to load the subreport when when the document.ready, unfortunately nothing happen on the load. Below is my code on the view.php

<div>
    <sub-report id='DashboardReport' name='DashboardReport'></sub-report>
</div>

<script src="/koolreport/core/src/clients/core/KoolReport.subReport.js">
    $(document).ready(function(){
          subReport.update("DashboardReport");

      });
</script>

The subReport(DashboardReport) is not reload at all. It will be load only if i put this way.

<div>
    <?php $this->subReport("DashboardReport"); ?>
</div>

I need the DashboardReport load after user login to the dashboard only. I try put debugger on /koolreport/core/src/clients/core/KoolReport.subReport.js, dont see any impact on that. Please advise, thank you.

stacy commented on Aug 29, 2020

Hi, any update on this?

<script type="text/javascript" ">
    subReport.on("updating",function(){
        console.log("The subreport is preparing to update");
    });
    subReport.on("updated",function(){
        console.log("The subreport is updated");
    });
</script>

I'm testing the code above , i'm getting the Uncaught ReferenceError: subReport is not defined.

David Winterburn commented on Aug 31, 2020

Hi Stacy,

Please copy and modify this standard example of ours to update a subreport:

https://www.koolreport.com/examples/reports/others/subreport_demo/

There's a listOrder button which call listOrder() function to update list order sub report.

If you want to auto update a subreport upon a page is loaded, please try KoolReport.load.onDone instead of $(document).ready, like this:

<script>
    KoolReport.load.onDone(function() {
        subReport.update("DashboardReport");
    });
</script>

Let us know if you have any problem with this. Thanks!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None