KoolReport's Forum

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

My Table Customization is not reading #2332

Closed Carlos Massavanhane opened this topic on on Sep 10, 2021 - 5 comments

Carlos Massavanhane commented on Sep 10, 2021

Hey, I've created a table but and add a costume table but its not be reading on the view. view

the code for setup:

areas,percentagem,desempenho
"I",80,"Bom"
"II",70,"Medio"
"III",60,"Mau"
"IV",90,"Bom"
"V",70,"Medio"
"VI",60,"Medio"
"VII",10,"Mau"
"VIII",10,"Mau"
"IX",80,"Bom"
"X",70,"Medio"
"XI",90,"Bom"
class TaxaDesempenhoDeCuidadosNacional extends KoolReport
{
    protected function settings()
    {
        return array(
            "dataSources" => array(
                "desempenho" => array(
                    "class" => CSVDataSource::class,
                    "filePath" => "/home/camjr/Documents/e-imdvbg/MISAU-IMD-VGB/backend/reports/taxadesempenhodecuidados/TaxaDeDesempenho.csv",
                ),
            )
        );
    }

    protected function setup()
    {
        $this->src('desempenho')
            ->pipe($this->dataStore('taxa_de_desempenho'));
    }
}

the .view.php file:

<div class="row">
    <div class="col-12">
        <?= Table::create([
            "name" => "taxa-desempenho",
            "dataSource" => $this->dataStore('taxa_de_desempenho'),
            "headers" => [
                [
                    "Area" => [],
                    "Desempenho" => ["colspan" => "2"],
                ],
                [
                    "10 Areas" => [],
                    "%" => [],
                    "(>=80% \"Bom\")(79%-60%\"Medio\")(>60%\"Mau\")" => [],
                
                ]
            ],
            "columns" => [
                "Areas" => [
                    "label" => "Areas",
                ],
                "percentagem" => [
                    "type" => "number",
                    "label" => "NĂºmero de US Avaliadas",
                    "footer" => "sum",
                ],
                "desempenho" => [
                    "type" => "text",
                    "label" => "Percentagem",
                ],
            ]
        ]); ?>
    </div>
</div>

the csv:

areas,percentagem,desempenho
"I",80,"Bom"
"II",70,"Medio"
"III",60,"Mau"
"IV",90,"Bom"
"V",70,"Medio"
"VI",60,"Medio"
"VII",10,"Mau"
"VIII",10,"Mau"
"IX",80,"Bom"
"X",70,"Medio"
"XI",90,"Bom"

Thank you in advance!

KoolReport commented on Sep 11, 2021

May I know your view file name. Is it named TaxaDesempenhoDeCuidadosNacional.view.php? (if not, try it)

Carlos Massavanhane commented on Sep 13, 2021

yes it is. I've just refactored it from TaxaDesempenhoDeCuidadosNacional to TaxaDesempenhoDeCuidadosUS The two files(setup and view)

KoolReport commented on Sep 13, 2021

The rule is very simple, the controller filename, the classname in controller and the view file prefix is the same, for example:

SaleReport.php contain SaleReport class with the view file SaleReport.view.php

Carlos Massavanhane commented on Sep 13, 2021

oh yeah thanks. I've found the error. one of the file was: TaxaDesempenhoDeCuidadosUS.php and other was TaxaDesemepenhoDeCuidadosUS.php

thanks a lot.

Carlos Massavanhane commented on Sep 13, 2021

the result: table_result_with_css

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

None