filetrs
This commit is contained in:
parent
38d5deb36a
commit
19e994ef38
@ -20,7 +20,7 @@
|
|||||||
"params": {"class": "table table-bordered", "border": "1"}
|
"params": {"class": "table table-bordered", "border": "1"}
|
||||||
},
|
},
|
||||||
"filters": [
|
"filters": [
|
||||||
"email", "description"
|
"email"
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
{"id": 1,"email":"fas1@mail.ru","description":"sdgsdfg","description2":"ffdghdas", "created_at": "17.06.2024", "status": 1},
|
{"id": 1,"email":"fas1@mail.ru","description":"sdgsdfg","description2":"ffdghdas", "created_at": "17.06.2024", "status": 1},
|
||||||
|
@ -15,6 +15,7 @@ $table->columns([
|
|||||||
'description' => [
|
'description' => [
|
||||||
"format" => "html",
|
"format" => "html",
|
||||||
"style" => ["width" => "300px"],
|
"style" => ["width" => "300px"],
|
||||||
|
"filter" => '',
|
||||||
"value" => function ($cell) {
|
"value" => function ($cell) {
|
||||||
return "<span style='color: sienna'>$cell</span>";
|
return "<span style='color: sienna'>$cell</span>";
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace Itguild\Tables;
|
|||||||
|
|
||||||
class JasonTable
|
class JasonTable
|
||||||
{
|
{
|
||||||
protected string $html = "";
|
public string $html = "";
|
||||||
protected \Closure|array|false $beforePrintCell;
|
protected \Closure|array|false $beforePrintCell;
|
||||||
protected \Closure|false $afterPrintHook;
|
protected \Closure|false $afterPrintHook;
|
||||||
protected \Closure|false $beforePrintHook;
|
protected \Closure|false $beforePrintHook;
|
||||||
|
@ -201,10 +201,10 @@ class ListJsonTable extends JasonTable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function issetFilter($filter): bool
|
private function issetFilter(string $filter): bool
|
||||||
{
|
{
|
||||||
if (isset($this->data['filters'])) {
|
if (isset($this->data['filters'])) {
|
||||||
foreach ($this->data['filters'] as $key => $currentFilter) {
|
foreach ($this->data['filters'] as $currentFilter) {
|
||||||
if (is_array($currentFilter)) {
|
if (is_array($currentFilter)) {
|
||||||
return false;
|
return false;
|
||||||
} elseif (is_string($currentFilter)) {
|
} elseif (is_string($currentFilter)) {
|
||||||
@ -214,7 +214,11 @@ class ListJsonTable extends JasonTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (is_array($this->beforePrintCell[$filter])) {
|
||||||
|
if (isset($this->beforePrintCell[$filter]['filter'])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user