fix filter submit button

This commit is contained in:
Билай Станислав 2024-12-23 15:24:15 +03:00
parent b7927bf3c8
commit d7e9e06925

View File

@ -73,8 +73,8 @@ class ListJsonTable extends JasonTable
} }
if ($this->showFiltersRow) { if ($this->showFiltersRow) {
$this->getFilters($columnKeys); $this->getFilters($columnKeys);
$this->html .= "</thead>";
} }
$this->html .= "</thead>";
} }
public function createTbody(): void public function createTbody(): void
@ -271,8 +271,10 @@ class ListJsonTable extends JasonTable
private function getFilters(array $columnKeys): void private function getFilters(array $columnKeys): void
{ {
$this->html .= "<tr><form action='$this->baseUrl/search'>"; $this->html .= "<tr><form action='$this->baseUrl/search'>";
$flag = false;
foreach ($columnKeys as $key) { foreach ($columnKeys as $key) {
if ($this->issetFilter($key)) { if ($this->issetFilter($key)) {
$flag = true;
$filter = $this->getCurrentFilter($key); $filter = $this->getCurrentFilter($key);
$params = [ $params = [
'param' => $filter['param'] ?? '', 'param' => $filter['param'] ?? '',
@ -290,7 +292,8 @@ class ListJsonTable extends JasonTable
$this->html .= "<td></td>"; $this->html .= "<td></td>";
} }
} }
if ($this->showActionColumn) { if ($flag) {
$this->showActionColumn = true;
$this->html .= "<td><input class='btn btn-primary' type='submit' style='width: 150px' value='Применить'></td>"; $this->html .= "<td><input class='btn btn-primary' type='submit' style='width: 150px' value='Применить'></td>";
} }
$this->html .= "</form></tr>"; $this->html .= "</form></tr>";