KoolReport's Forum

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

Dashboard : using both FIELD and INPUT buttons on same dashboard #2571

Open Mathieu Viennet opened this topic on on Feb 12, 2022 - 2 comments

Mathieu Viennet commented on Feb 12, 2022

Hi,

in one dashboard, i have a BACK button at top and inside a TABLE i have buttons to load another dashboard.

I need to use :

use \koolreport\dashboard\inputs\Button;
use \koolreport\dashboard\fields\Button;

But when I do, my application crash.

If i use both separately, it works.

Panel code :

Panel::create()->width(1/4)->cssClass("trans-row page-title back-button")
					->sub([
					Button::create()->text("Return to report")->onClick(function(){
					return Client::dashboard("SalesByRep")->load();
            		}),

Button inside Table code :

 			Button::create("viewDetails")
                ->type("warning")
                ->label("")
                ->textAlign("right")
                ->text("View Invoices")
                ->onClick(function($value, $row){
                    return Client::dashboard("SalesByRepCustomerInvoices")->load([
                        "customer_id"=>$row["customer_id"],
						"customer_name"=>$row["customer_name"], 
						"start_date"=>$_SESSION['inc_start_date'],
                        "end_date"=>$_SESSION['inc_end_date']            
                    ]);                   
                }),

Thanks for helping

KoolReport commented on Feb 13, 2022

If you have two classes with same name then you use alias like this:

use \koolreport\dashboard\inputs\Button;
use \koolreport\dashboard\fields\Button as FieldButton;

Later in the table, you use the FieldButton alias instead of Button.

Mathieu Viennet commented on Feb 13, 2022

Thank you very much!

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

Dashboard