3 Commits
1.0 ... 1.0.3

Author SHA1 Message Date
1f2b93baf1 table filter fix 2024-08-29 12:41:17 +03:00
5cb5ac839d table params fix 2024-08-29 12:07:54 +03:00
cf2cada74e fix date format 2024-08-29 11:49:46 +03:00
3 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,8 @@
<?php
ini_set("display_errors", true);
error_reporting(-1);
require_once "../vendor/autoload.php";
use Itguild\Tables\Filter\InputDateFilter;

View File

@ -64,7 +64,7 @@ class ListJsonTable extends JasonTable
$this->html .= "<th>" . "ID" . "</th>";
$columnKeys[] = "id";
}
$columnKeys = $this->getColumnKeys();
$columnKeys = array_merge($columnKeys, $this->getColumnKeys());
$columnKeys = array_merge($columnKeys, $this->getCustomColumnKeys());
$this->getCustomHeadColumn();
if ($this->showActionColumn) {
@ -92,6 +92,9 @@ class ListJsonTable extends JasonTable
foreach ($row as $key => $cell) {
if ($this->issetColumn($key) and $this->is_fillable($key)) {
if($this->beforePrintCell) {
if ($key === "id" and $cell === 0){
$cell = $this->count;
}
$cell = $this->getCustomCell($key, $cell);
}
$this->html .= "<td style='" . $this->getStyleFromCustomColumn($key) . "'>" . $cell . "</td>";
@ -229,7 +232,7 @@ class ListJsonTable extends JasonTable
}
}
}
if (is_array($this->beforePrintCell[$filter])) {
if (isset($this->beforePrintCell[$filter]) and is_array($this->beforePrintCell[$filter])) {
if (isset($this->beforePrintCell[$filter]['filter'])) {
return true;
}
@ -268,9 +271,9 @@ class ListJsonTable extends JasonTable
if ($this->issetFilter($key)){
$filter = $this->getCurrentFilter($key);
$class = new $filter['class']([
'param' => $filter['param'],
'param' => $filter['param'] ?? '',
'name' => $key,
'value' => $filter['value']
'value' => $filter['value'] ?? '',
]);
$this->html .= $class->fetch();
}

View File

@ -12,6 +12,6 @@ class DateFormat extends BaseFormat
*/
static function fetch(?string $data, string $options = ""): ?string
{
return (new DateTimeImmutable($data))->format($options) ?? null;
return (new DateTimeImmutable($data ?? ""))->format($options) ?? null;
}
}