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