KoolReport's Forum

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

How to show Card widget? #2818

Closed Daniel opened this topic on on Sep 4, 2022 - 2 comments

Daniel commented on Sep 4, 2022

I'm new to Koolreport, I'm working with the Card component, but it doesn't appear in the report view. In the console it appears to be there, but it isn't, this image would better explain what I'm trying to describe:

I haven't made any changes to the CSS of the Card component or anything like that, I'm just copying what the documentation says:

<?php
    $total = 0;
    foreach ($this->dataStore("resources") as $obj) {
        $total += $obj['amount'];
    }
    Card::create(array(
        "value" => $total,
        "title" => "Total",
        "cssClass" => array(
            "card" => "bg-info",
            "title" => "text-white",
            "value" => "text-white"
        )
    ))
    ?>

I don't really know what is the problem. Any help is appreciated.

KoolReport commented on Sep 4, 2022

Do you use bootstrap css in the report?

If not please try to add:

class MyReport extends KoolReport
{
    use \koolreport\clients\Bootstrap; //<-This line
}

Let me know.

Daniel commented on Sep 4, 2022

Hi, yes, it's in the class:

<?php
namespace App\Reports;

class MyReport extends \koolreport\KoolReport
{
    use \koolreport\laravel\Friendship;

    use \koolreport\clients\Bootstrap;

    function settings()
    {
        return array(
            "dataSources"=>array(
                "mysql"=>array(
                    "class"=>'\koolreport\laravel\Eloquent', // This is important
                )
            )
        );
    }
    
    function setup()
    {
        $this->src("mysql")->query(
            //some query...
        )
        ->pipe($this->dataStore("data"));
    }
}
?>

I'm also using other components like the column chart or the bar chart and both are working fine.

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
solved

None