KoolReport's Forum

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

The server responded with a status of 404 (Could not find [displayreport] sub report) #1605

Open kames opened this topic on on Aug 31, 2020 - 1 comments

kames commented on Aug 31, 2020

I have integrated subreport with daterange filter using laravel ajax loading.

After selecting date range and click "filter" button, i got the following error message

Failed to load resource: the server responded with a status of 404 (Could not find [displayreport] sub report)

This is my code

DashboardReport.php

<?php

namespace App\Reports; use \koolreport\querybuilder\DB; use \koolreport\querybuilder\MySQL; use App\Reports\FilterForm; use App\Reports\DisplayCard; use App\Reports\DisplayReport;

class DashboardReport extends \koolreport\KoolReport {

use \koolreport\laravel\Friendship; 
 use \koolreport\clients\jQuery;
 use \koolreport\core\SubReport;
// By adding above statement, you have claim the friendship between two frameworks
// As a result, this report will be able to accessed all databases of Laravel
// There are no need to define the settings() function anymore
// while you can do so if you have other datasources rather than those
// defined in Laravel.

function settings()
{
    return array(
        "subReports"=>array(
            "displaycard"=>DisplayCard::class,
            "filterform"=>FilterForm::class,
            "displayreport"=>DisplayReport::class,
        )
    );
}

}

?>

FilterForm.view.php

<?php

use \koolreport\inputs\DateRangePicker; use \koolreport\clients\jquery; use \koolreport\core\SubReport;

?>

 <?php echo csrf_field() ?>
        <div class="col-md-4 form-group">
        <?php DateRangePicker::create(array(
             "locale"=>"en-us",
            "name"=>"dateRange",
           
        ));?>
      </div>

<div class="form-group col-md-2">

    <button   class="btn btn-success doFilter" type="submit">Filter</button>
</div>

<script type="text/javascript">

$(document).ready(function(){
     $(document).on("click",".doFilter",function() {

    $.ajaxSetup({
headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}

});

    console.log("kames"+$('#dateRange_start').val());
    
    subReport.update("displayreport",{
    "dateRange_page":[$('#dateRange_start').val(),$('#dateRange_start').val()],

});

});

     });

</script>

David Winterburn commented on Sep 1, 2020

If you are using Laravel it could be a routing problem. Please open developer tool -> Network tab -> xhr to see if there's any failed xhr request. Check the xhr request to see if its url is a correct route in your Laravel app.

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
help needed

Laravel