filters
This commit is contained in:
@ -2,9 +2,11 @@
|
||||
"meta": {
|
||||
"title": "forma 1",
|
||||
"columns": {
|
||||
"id": "ID",
|
||||
"email": "Email",
|
||||
"description": "Описание 1",
|
||||
"description2": "Описание 2"
|
||||
"description2": "Описание 2",
|
||||
"status": "Статус"
|
||||
},
|
||||
"actions": ["view"],
|
||||
"pagination": true,
|
||||
@ -17,18 +19,18 @@
|
||||
"params": {"class": "table table-bordered", "border": "1"}
|
||||
},
|
||||
"filters": [
|
||||
"id", "email"
|
||||
"email", "description"
|
||||
],
|
||||
"data": [
|
||||
{"id": 1,"email":"fas1@mail.ru","description":"sdgsdfg","description2":"ffdghdas"},
|
||||
{"id": 2,"email":"fas2@mail.ru","description":"fafdgdfgsdfdfs","description2":"ffdghdas"},
|
||||
{"id": 3,"email":"fas3@mail.ru","description":"fafdgdssdfgdfs","description2":"ffdghdas"},
|
||||
{"id": 4,"email":"fas4@mail.ru","description":"fafddsfgsdvcbgdfs","description2":"ffdghdas"},
|
||||
{"id": 5,"email":"fas5@mail.ru","description":"fafdgghjgfdfs","description2":"ffdghdas"},
|
||||
{"id": 6,"email":"fas6@mail.ru","description":"fafddfgdhvgdfs","description2":"ffdghdas"},
|
||||
{"id": 7,"email":"fas7@mail.ru","description":"fafdfgnfdgdfs","description2":"ffdghdas"},
|
||||
{"id": 8,"email":"fas8@mail.ru","description":"fafdfghdfgdfs","description2":"ffdghdas"},
|
||||
{"id": 12,"email":"dfdfd@mail.ru","description":"sdffhdfhggsdfg","description2":"ffdgdfgsdfghdas"},
|
||||
{"id": 13,"email":"dfsdfsddfd@mail.ru","description":"sdffhdfsdfshggsdfg","description2":"ffdgdsdffgsdfghdas"}
|
||||
{"id": 1,"email":"fas1@mail.ru","description":"sdgsdfg","description2":"ffdghdas", "status": 1},
|
||||
{"id": 2,"email":"fas2@mail.ru","description":"fafdgdfgsdfdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 3,"email":"fas3@mail.ru","description":"fafdgdssdfgdfs","description2":"ffdghdas", "status": 2},
|
||||
{"id": 4,"email":"fas4@mail.ru","description":"fafddsfgsdvcbgdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 5,"email":"fas5@mail.ru","description":"fafdgghjgfdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 6,"email":"fas6@mail.ru","description":"fafddfgdhvgdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 7,"email":"fas7@mail.ru","description":"fafdfgnfdgdfs","description2":"ffdghdas", "status": 0},
|
||||
{"id": 8,"email":"fas8@mail.ru","description":"fafdfghdfgdfs","description2":"ffdghdas", "status": 1},
|
||||
{"id": 12,"email":"dfdfd@mail.ru","description":"sdffhdfhggsdfg","description2":"ffdgdfgsdfghdas", "status": 99},
|
||||
{"id": 13,"email":"dfsdfsddfd@mail.ru","description":"sdffhdfsdfshggsdfg","description2":"ffdgdsdffgsdfghdas", "status": 1}
|
||||
]
|
||||
}
|
@ -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 => "Удален",
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user