This commit is contained in:
2024-08-01 13:32:31 +03:00
parent 39931b257b
commit 433cc85f54
4 changed files with 89 additions and 30 deletions

View File

@ -6,17 +6,39 @@ use Itguild\Tables\ListJsonTable;
$json = file_get_contents('simple.json');
$table = new ListJsonTable($json);
$table->setBeforePrintCell(function ($key, $data) {
return $key == "email" ? "<span style='color: aqua'>$data</span>" : $data;
});
//$table->column("status", function ($ceil){
// return getStatusLabel()[$ceil];
//});
//$table->columns([
// 'status' => function ($ceil) {
// return getStatusLabel()[$ceil];
// },
// 'email' => function ($ceil) {
// return "<span style='color: aqua'>$ceil</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>";
});
$table->addColumn("Колонка 33", "k33", function ($id){
$table->addColumn("Колонка 33", "k33", function ($id) {
return "my ID: " . $id;
});
$table->addColumn("Колонка 34", "k34", function ($id){
$table->addColumn("Колонка 34", "k34", function ($id) {
return "some34";
});
$table->create();
$table->render();
$table->render();
function getStatusLabel(): array
{
return [
0 => "На модерации",
1 => "Активный",
2 => "Модератор",
99 => "Удален",
];
}