KoolReport's Forum

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

DataTables vs Table : why DataTables is working but Table not working? #2933

Open AhmedHaroon opened this topic on on Jan 10, 2023 - 7 comments

AhmedHaroon commented on Jan 10, 2023

i am trying to use Table and DataTables, code below is working with DataTables but not Table, please help me what is wrong here or missed. also please guide for alignment of fields especially right align numer fields.

TestReport.php

<?php
namespace App\Reports;

require APPPATH."Libraries/koolreport/autoload.php";

class TestReport extends \koolreport\KoolReport
{
    use \koolreport\codeigniter\Friendship;
    function setup()
    {
        $this->src("default")
        ->query("SELECT * FROM zones")
        ->pipe($this->dataStore("zones"));          
    }
}

TestReport.view.php

<?php
use \koolreport\widgets\koolphp\Table;
?>
<div class='report-content'>
    <div class="text-center">
        <h1>Zones List</h1>
        <p class="lead">The report show Zones</p>
    </div>

    <?php
    Table::create(array(
        "dataStore"=>$this->dataStore("zones")->sort(array("id"=>"desc")),
        "columns"=>array(
            "id"=>array(
                "label"=>"Zone ID",
                "type"=>"number",
                "prefix"=>"$",
            ),
            "zone_name"=>array(
                "label"=>"Zone Name"
            ),
        ),
        "paging"=>array(
            "pageSize"=>10,
        ),
        "cssClass"=>array(
            "table"=>"table table-bordered table-striped"
        )
    ));
    ?>
</div>

regards

KoolReport commented on Jan 10, 2023

May I know what is not working. Is there error showing?

AhmedHaroon commented on Jan 10, 2023

@KoolReport

no, there is no error, above code is showing data in plain text format on blank page.

note: in another test report, also no bootstap4 or amazing theme works, no <h1> or <p> etc. is center, not daterange picker is appearing as it should be and not button too... button is black & white.

Sebastian Morales commented on Jan 11, 2023

If possible, pls provide screenshots so that we could understand your problem better. Tks,

AhmedHaroon commented on Jan 11, 2023

@Sebastian Morales

yeah, sure its here....

regards

Sebastian Morales commented on Jan 12, 2023

Pls open your report web page's dev tool (F12), reload the page and let us know if there's any error showing in console (red messages).

Sebastian Morales commented on Jan 12, 2023

By the way, pls try to add the following Bootstrap trait to your report:

class TestReport extends \koolreport\KoolReport
{
    use \koolreport\bootstrap4\Theme;

The widget Table needs Bootstrap for style.

AhmedHaroon commented on Jan 13, 2023

thanks a bunch @Sebastian Morales for help.

this works perfectly... two thumbs up !!

regards

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
solved

None