diff --git a/examples/simple.php b/examples/simple.php index 768bb10..0584bd7 100644 --- a/examples/simple.php +++ b/examples/simple.php @@ -9,12 +9,13 @@ $table = new ListJsonTable($json); $table->columns([ "created_at" => [ - "format" => "date:Y-m-d" + "format" => "date:Y-m-d", + 'filter' => "date" ], 'description' => [ "format" => "html", "style" => ["width" => "300px"], - "filter" => '', + "filter" => "text", "value" => function ($cell) { return "$cell"; } diff --git a/src/JasonTable.php b/src/JasonTable.php index 5080b1d..53be197 100644 --- a/src/JasonTable.php +++ b/src/JasonTable.php @@ -90,4 +90,14 @@ class JasonTable return $styleStr; } + + protected function getFilterFromCustomColumn(string $column) + { + if (is_array($this->beforePrintCell[$column])) { + if (isset($this->beforePrintCell[$column]['filter'])) { + return $this->beforePrintCell[$column]['filter']; + } + } + return "text"; + } } \ No newline at end of file diff --git a/src/ListJsonTable.php b/src/ListJsonTable.php index 051de24..20be360 100644 --- a/src/ListJsonTable.php +++ b/src/ListJsonTable.php @@ -251,7 +251,7 @@ class ListJsonTable extends JasonTable $this->html .= "
"; foreach ($columnKeys as $key){ if ($this->issetFilter($key)){ - $this->html .= ""; + $this->html .= ""; } else { $this->html .= "";