KoolReport's Forum

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

Dashboard demo pulling from demo/ folder: how to make custom Boards in the demo? #2399

Open Niall McGuirk opened this topic on on Oct 20, 2021 - 2 comments

Niall McGuirk commented on Oct 20, 2021

I've been trying to modify the demo dashboard to show data from another database, on a custom Board.php. However, when I change the Products Board from using Automaker to my Database, which I'd copied the format of Automaker to make, I keep getting a missing file, in demo.

I've tried to find the demo folder, but can't find it in the directory anywhere.

I've placed the 'test' folder in the src directory, similar to the rest, with a Board and Table.php within it.

It seems that every change causes problems with this demo/ folder, is there a way to resolve this?

KoolReport commented on Oct 22, 2021

Do you have the "test/DeadhackBoard.php" with content:

<?php

namespace demo\test; //->this is important so that you have \demo\test\DeadhackBoard class

class DeadhackBoard extends \koolreport\dashboard\CustomBoard
{

}
Niall McGuirk commented on Oct 22, 2021

I've added the above code, into the DealhackBoard.php which worked, adding a new board to the demo menu, once adding the new Dashboard to the dashboards function in App.php

But the error when clicking the new menu, said the following:

So I took the view file from my previous reports, which used a MyReport.php and MyReport.view.php, and renamed it, and placed it in test, which now shows this error:

What file do I put the source into, and what format should it resemble? The format in KR config.php (connection/username/password/charString), or in the dataSource() function in DealhackTable.php?

DealhackBoard.php

<?php

use \koolreport\dashboard\widgets\Table;
use \koolreport\dashboard\fields\Currency;
use \koolreport\dashboard\fields\DateTime;
use \koolreport\dashboard\fields\Text;

namespace demo\test;

class DealhackTable extends Table
{
    protected function dataSource()
    {
        return DealHack::table("tbl_dealhack")->limit(10);
    }

    protected function fields()
    {
        return [
            DateTime::create("created_date")
                ->displayFormat("M jS, Y"),
            
            Text::create("hack_description"),
                
        ];
    }
}
?>

This is the contents of test currently:

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

Dashboard