fix filter
This commit is contained in:
@ -147,13 +147,21 @@ class ListJsonTable extends JasonTable
|
||||
$this->actionsArray = array_merge($this->actionsArray, $this->customActionsArray);
|
||||
}
|
||||
|
||||
private function getCurrentFilter(string $filter): false|string
|
||||
private function getCurrentFilter(string $column)
|
||||
{
|
||||
return match ($filter) {
|
||||
'input' => InputFilter::class,
|
||||
'select' => SelectFilter::class,
|
||||
default => false,
|
||||
};
|
||||
// return match ($filter) {
|
||||
// 'input' => InputFilter::class,
|
||||
// 'select' => SelectFilter::class,
|
||||
// default => false,
|
||||
// };
|
||||
if (is_array($this->beforePrintCell[$column])) {
|
||||
if (isset($this->beforePrintCell[$column]['filter'])) {
|
||||
if (is_array($this->beforePrintCell[$column]['filter'])) {
|
||||
return $this->beforePrintCell[$column]['filter'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getCustomColumns($id = null): void
|
||||
@ -269,12 +277,18 @@ class ListJsonTable extends JasonTable
|
||||
foreach ($columnKeys as $key){
|
||||
if ($this->issetFilter($key)){
|
||||
// $this->html .= "<td><input type='" . $this->getFilterFromCustomColumn($key) . "' name='$key'></td>";
|
||||
$item = $this->getCurrentFilter($this->getTagFromCustomColumn($key));
|
||||
$objItem = new $item([
|
||||
'data' => $this->getFilterFromCustomColumn($key),
|
||||
// $item = $this->getCurrentFilter($this->getTagFromCustomColumn($key));
|
||||
// $objItem = new $item([
|
||||
// 'data' => $this->getFilterFromCustomColumn($key),
|
||||
// 'name' => $key
|
||||
// ]);
|
||||
// $this->html .= $objItem->fetch();
|
||||
$arr = $this->getCurrentFilter($key);
|
||||
$class = new $arr['class']([
|
||||
'param' => $arr['param'],
|
||||
'name' => $key
|
||||
]);
|
||||
$this->html .= $objItem->fetch();
|
||||
$this->html .= $class->fetch();
|
||||
}
|
||||
else {
|
||||
$this->html .= "<td></td>";
|
||||
|
Reference in New Issue
Block a user