table filter fix

This commit is contained in:
Kavalar 2024-08-29 13:08:43 +03:00
parent 1f2b93baf1
commit 453917ea1a
2 changed files with 12 additions and 4 deletions

View File

@ -15,11 +15,11 @@
"currentPage": "1",
"showActionColumn": true,
"showFiltersRow": true,
"filter": true,
"total": 10,
"paginationPrefix": "/page",
"params": {"class": "table table-bordered", "border": "1"}
},
"filters": ["email", "status"],
"data": [
{"id": 1,"email":"fas1@mail.ru","description":"sdgsdfg","description2":"ffdghdas", "created_at": "17.06.2024", "status": "1"},
{"id": 2,"email":"fas2@mail.ru","description":"fafdgdfgsdfdfs","description2":"ffdghdas", "created_at": "18.06.2024", "status": "1"},

View File

@ -6,6 +6,7 @@ use Exception;
use Itguild\Tables\ActionColumn\DeleteActionColumn;
use Itguild\Tables\ActionColumn\EditActionColumn;
use Itguild\Tables\ActionColumn\ViewActionColumn;
use Itguild\Tables\Filter\InputTextFilter;
use Itguild\Tables\traits\CreateParams;
use JetBrains\PhpStorm\NoReturn;
@ -270,12 +271,19 @@ class ListJsonTable extends JasonTable
foreach ($columnKeys as $key){
if ($this->issetFilter($key)){
$filter = $this->getCurrentFilter($key);
$class = new $filter['class']([
$params = [
'param' => $filter['param'] ?? '',
'name' => $key,
'value' => $filter['value'] ?? '',
]);
$this->html .= $class->fetch();
];
if ($filter){
$class = new $filter['class']($params);
$this->html .= $class->fetch();
}
else {
$class = new InputTextFilter($params);
$this->html .= $class->fetch();
}
}
else {
$this->html .= "<td></td>";