KoolReport's Forum

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

Make paging optional #2859

Open Dan Merns opened this topic on on Nov 1, 2022 - 2 comments

Dan Merns commented on Nov 1, 2022

Hello, I started using KoolReport recently. I have it set up but need to refine various things.

Is there a way to make Paging optional?

I have Paging working with

"paging"=>[
  "pageSize"=>25
]

But if I try to pass this as a variable it does not work. Here is an example of that:

if($this->dataStore("report")->countData() > 25){
     $paging['paging']=['pageSize'=>25];
}else{
     $paging = [];
}
    
Table::create([
        "dataStore"=>$this->dataStore("report"),
        "class"=>[
            "table"=>"table table-hover"
        ],
        $paging
]);

Is there a way to make paging optional? Thanks

Sebastian Morales commented on Nov 2, 2022

Pls try this code:

  $tableSetting = [
        "dataStore"=>$this->dataStore("report"),
        "class"=>[
            "table"=>"table table-hover"
        ]
];

if($this->dataStore("report")->countData() > 25){
     $tableSetting['paging'] = ['pageSize'=>25];
}

Table::create($tableSetting);
 

Hope it works for your case. Tks,

Dan Merns commented on Nov 2, 2022

Great thank you Sebastian!

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