KoolReport's Forum

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

Laravel - Blade Templates - addCssFile() - addScriptFileOnBegin() #182

Open Paulo Morais opened this topic on on Dec 28, 2017 - 3 comments

Paulo Morais commented on Dec 28, 2017

I use Blade templates. The CSS/JS is loaded with the layout files. Is there any option that prevents loading of CSS / JS dependencies from each package?

KoolReport commented on Dec 30, 2017

Hi, could you please explain further the situation. What problem do you face with loading css/js dependencies from each package?

Paulo Morais commented on Dec 30, 2017

Packages used: DataGrid / DataTables Morris

Template code inherited by all pages <head> ... <link rel="stylesheet" type="text/css" href="https://domain.tld/assets/plugins/bootstrap/css/bootstrap.css"> <link rel="stylesheet" type="text/css" href="https://domain.tld/assets/plugins/datatables/datatables.min.css"> <script src="https://domain.tld/assets/js/jquery-2.2.4.min.js"></script> <script src="https://domain.tld/assets/plugins/bootstrap/js/bootstrap.js"></script> <script src="https://domain.tld/assets/plugins/datatables/datatables.min.js"></script> ... </head>

Code generated by the DataGrid / Morris packages <body> ... <script type="text/javascript" src="/vendor/koolreport/packages/datagrid/DataTables/datatables.min.js"></script> <link type="text/css" rel="stylesheet" href="/vendor/koolreport/packages/datagrid/DataTables/dataTables.min.css"> <script type="text/javascript" src="/vendor/koolreport/clients/raphael/raphael.min.js"></script> <script type="text/javascript" src="/vendor/koolreport/clients/jquery/jquery.min.js"></script> <script type="text/javascript" src="/vendor/koolreport/packages/morris_chart/assets/morris.min.js"></script> <link type="text/css" rel="stylesheet" href="/vendor/koolreport/packages/morris_chart/assets/morris.css"> ... </body>

This causes JavaScript errors.

KoolReport commented on Dec 31, 2017

I think it is because of jQuery is registered twice with different version. You may go to our code "DataTables.php" and "Morris.php" and comment out the line of jQuery register

//$this->getReport()->getResourceManager()->addScriptFileOnBegin($jqueryPublicUrl."/jquery.min.js");

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

DataGrid