Hi again!
I created a table to display the users of the website. It shows up correctly so far, but I did not get the way to connect one row oft that table to a modal, where I can edit the data of it. I'm kind of lost in your documentation.
Here ist the class of the table:
<?php
namespace App\KV\Dashboard\Tables;
use App\KV\Dashboard\DataSources\Web ;
use koolreport\dashboard\Client;
use koolreport\dashboard\fields\Boolean;
use koolreport\dashboard\fields\Button;
use koolreport\dashboard\fields\Date;
use koolreport\dashboard\fields\Number;
use koolreport\dashboard\fields\Text;
class UserTable extends \koolreport\dashboard\widgets\Table
{
protected function onInit(){
$this->tableStriped(true)
;
}
protected function dataSource()
{
return Web::table('users');
}
protected function fields(){
return [
Number::create('id')->useRaw(true)->label('User-ID'),
Text::create('name')->label('Name'),
Text::create('email')->label('Email'),
Text::create('password')->label('Passwort'),
Date::create('created_at')->baseFormat("Y-m-d H:i:s")->displayFormat('Y-m-d')->label('Zugelassen am'),
Date::create('updated_at')->baseFormat("Y-m-d H:i:s")->displayFormat('Y-m-d')->label('Bearbeitet am'),
Boolean::create('admin')->label('Admin'),
Button::create('id')->label('')->type("warning")
->size("sm")
->outline(false)
->text("User bearbeiten")
->onClick(function($value,$row){
return Client::widget("UserTable")->action("edit",["id"=>$value]);
}),
Button::create('id')->label('')->type("danger")
->size("sm")
->outline(false)
->text("User löschen")
->onClick(function($value,$row){
return Client::widget("UserTable")->action("delete",["id"=>$value]);
}),
];
}
protected function actionEdit($request,$response){
//TODO User editieren
}
protected function actionDelete($request, $response){
//TODO User löschen
}
}
Can you point me a way to display a row in modal for editing saving it? Which way I have to go?
Thanks again for your help!
Peter