ClientSide
Dashboard contains a koolreport\dashboard\Client
class which acts as a helper to generate client javascript code at client-side.
Common #
showLoader() #
This function will generate javascript to show loading.
protected function content()
{
return [
Button::create()->onClick(
Client::showLoader()
)
];
}
logout() #
This function will generate javascript to logout of the application
protected function content()
{
return [
Button::create()->text("Logout")->onClick(
Client::logout()
)
];
}
navigate #
Client::navigate(string $route[, $params])
Navigate within application
Example:
Client::navigate("App/MyPage/MyDashboard")
Client::navigate("App/MyPage/MyDashboard",["key"=>"value"])
setTimeout #
Client::setTimeout($js, $msec);
Set time out to run an javascript
Example:
Client::setTimeout("alert('something')",1000);
historyBack #
Simply go back in navigation history
Client::historyBack()
Application Client #
To access the client helper for app, you call Client::app()
Methods #
Name | description |
---|---|
action(string $name, [array $params]) | Perform an action on dashboard |
changeLanguage([string $name],[array $params]) | Export dashboard to PDF |
Dashboard Client #
Access #
To access the client helper for a Dashboard, you do Client::dashboard("NameOfDashboard")
, for example
$clientDashboard = Client::dashboard("ProductBoard");
Alternatively, you can enter the Dashboard object, for example
class MyDashboard extends Dashboard
{
protected function content()
{
return [
Button::create()->text("Export")->onClick(
Client::dashboard($this)->exportToPDF() // $this here refers to MyDashboard
)
];
}
}
Methods #
Name | description |
---|---|
load([array $params]) | Load a dashboard |
action(string $name, [array $params]) | Perform an action on dashboard |
exportToPDF([string $name],[array $params]) | Export dashboard to PDF |
exportToJPG([string $name],[array $params]) | Export dashboard to JPG |
exportToPNG([string $name],[array $params]) | Export dashboard to PNG |
exportToXLSX([string $name],[array $params]) | Export dashboard to Excel |
exportToCSV([string $name],[array $params]) | Export dashboard to CSV |
Example:
// Load ProductBoard
Client::dashboard("ProductBoard")->load();
//Load product board with productLine parameter
Client::dashboard("ProductBoard")->load(["productLine"=>1088]);
//Call actionUpdate() inside ProductBoard with parameters.
Client::dashboard("ProductBoard")->action("Update",["productLine"=>1088]);
//Export to PDF with file name ProductBoard.pdf
Client::dashboard("ProductBoard")->exportToPDF();
//Export to PDF with custom name and parameters
Client::dashboard("ProductBoard")->exportToPDF("CustomName",["all"=>true]);
Widget Client #
Access #
To access the client helper for a Widget, you do Client::widget("NameOfWidget")
, for example
$widgetClientHelper = Client::widget("OfficeTable");
Methods #
Name | description |
---|---|
update() | Refresh widget |
action(string $action, [array $params]) | Perform an action on widget |
showDetail([array $params]) | Show detail data behind widget |
exportToPDF([string $name],[array $params]) | Export widget to PDF |
exportToJPG([string $name],[array $params]) | Export widget to JPG |
exportToPNG([string $name],[array $params]) | Export widget to PNG |
exportToXLSX([string $name],[array $params]) | Export widget to Excel |
exportToCSV([string $name],[array $params]) | Export widget to CSV |
Example:
// Refesh widget
Client::widget("OfficeTable")->update();
// Show detail
Client::widget("OfficeTable")->showDetail();
// Perform an action of widget
Client::widget("OfficeTable")->action("Paging",["pageIndex"=>2]);
//Export to PDF
Client::widget("OfficeTable")->exportToPDF();
//Export to PDF with custom name and parameters
Client::widget("OfficeTable")->exportToPDF("All Tables",["all"=>true]);
Get started with KoolReport
KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.