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>