some fix filters

This commit is contained in:
Билай Станислав 2024-08-28 12:12:52 +03:00
parent b4dc2f6ab1
commit f03ec200ac
4 changed files with 13 additions and 11 deletions

View File

@ -15,7 +15,7 @@ $table->columns([
'description' => [
"format" => "html",
"style" => ["width" => "300px"],
"filter" => ["input" => ["radio" => "hello", "bye"]],
"filter" => ["input" => ["radio" => ["hello", "bye"]]],
"value" => function ($cell) {
return "<span style='color: sienna'>$cell</span>";
}

View File

@ -13,7 +13,9 @@ class InputFilter extends Filter
// $this->html = "<td>";
//// var_dump(key($this->data));
// $key = key($this->data);
// foreach ($this->data as $value){
// foreach ($this->data[$key] as $value){
//// echo "<pre>";
//// print_r($value);
// $this->html .= "<input type='$key' name='$this->name' value='$value'>";
// }
// return $this->html . "</td>";

View File

@ -96,9 +96,9 @@ class JasonTable
if (is_array($this->beforePrintCell[$column])) {
if (isset($this->beforePrintCell[$column]['filter'])) {
if (is_array($this->beforePrintCell[$column]['filter'])) {
foreach ($this->beforePrintCell[$column]['filter'] as $key => $value) {
return $key;
}
// foreach ($this->beforePrintCell[$column]['filter'] as $key => $value) {
return key($this->beforePrintCell[$column]['filter']);
// }
}
}
}
@ -110,9 +110,11 @@ class JasonTable
if (is_array($this->beforePrintCell[$column])) {
if (isset($this->beforePrintCell[$column]['filter'])) {
if (is_array($this->beforePrintCell[$column]['filter'])) {
foreach ($this->beforePrintCell[$column]['filter'] as $value) {
return $value;
}
// foreach ($this->beforePrintCell[$column]['filter'] as $value) {
// echo "<pre>";
// print_r(current($this->beforePrintCell[$column]['filter']));
return current($this->beforePrintCell[$column]['filter']);
// }
}
}
}

View File

@ -269,12 +269,10 @@ class ListJsonTable extends JasonTable
foreach ($columnKeys as $key){
if ($this->issetFilter($key)){
// $this->html .= "<td><input type='" . $this->getFilterFromCustomColumn($key) . "' name='$key'></td>";
$tag = $this->getTagFromCustomColumn($key);
$item = $this->getCurrentFilter($tag);
$item = $this->getCurrentFilter($this->getTagFromCustomColumn($key));
$objItem = new $item([
'data' => $this->getFilterFromCustomColumn($key),
'name' => $key
// 'value' => $this->getFilterFromCustomColumn($key)
]);
$this->html .= $objItem->fetch();
}