fix filter

This commit is contained in:
2024-08-28 14:21:00 +03:00
parent f03ec200ac
commit 5064042929
6 changed files with 83 additions and 63 deletions

View File

@ -2,6 +2,8 @@
require_once "../vendor/autoload.php";
use Itguild\Tables\Filter\InputFilter;
use Itguild\Tables\Filter\SelectFilter;
use Itguild\Tables\ListJsonTable;
$json = file_get_contents('simple.json');
@ -10,32 +12,49 @@ $table = new ListJsonTable($json);
$table->columns([
"created_at" => [
"format" => "date:Y-m-d",
'filter' => ["input" => "date"]
'filter' => [
'class' => InputFilter::class,
'param' => 'date'
]
],
'description' => [
"format" => "html",
"style" => ["width" => "300px"],
"filter" => ["input" => ["radio" => ["hello", "bye"]]],
"filter" => [
'class' => InputFilter::class,
'param' => 'text'
],
"value" => function ($cell) {
return "<span style='color: sienna'>$cell</span>";
}
],
'description2' => [
"filter" => ["input" => "text"],
"format" => "html",
"filter" => [
'class' => SelectFilter::class,
'param' => ['black', 'red', 'green', 'blue', 'yellow']
],
],
'status' => [
"format" => "integer",
"filter" => ["select" => getStatusLabel()],
"filter" => [
'class' => SelectFilter::class,
'param' => getStatusLabel()
],
"value" => function ($cell) {
return getStatusLabel()[$cell];
}],
'k33' => [
"format" => "integer",
'filter' => [
'class' => InputFilter::class,
'param' => 'range'
]
],
'email' => function ($cell) {
return "<span style='color: aqua'>$cell</span>";
},
]);
//$table->setBeforePrintCell(function ($key, $data) {
// return $key == "email" ? "<span style='color: aqua'>$data</span>" : $data;
//});
$table->afterPrint(function ($meta) {
return "<div>After Print</div>";
});