jqh %!s(int64=5) %!d(string=hai) anos
pai
achega
4953682b47

+ 1 - 1
resources/views/filter/multipleselect.blade.php

@@ -5,7 +5,7 @@
 
     <select class="form-control {{ $class }}" name="{{$name}}[]" multiple style="width: 100%;">
         @foreach($options as $select => $option)
-            <option value="{{$select}}" {{ in_array((string)$select, request($name, []))  ?'selected':'' }}>{{$option}}</option>
+            <option value="{{$select}}" {{ in_array((string)$select, (array) $value)  ?'selected':'' }}>{{$option}}</option>
         @endforeach
     </select>
 </div>

+ 2 - 2
resources/views/filter/select.blade.php

@@ -3,12 +3,12 @@
         <span class="input-group-text bg-white text-capitalize"><b>{!! $label !!}</b></span>
     </div>
 
-    <select class="form-control {{ $class }}" name="{{$name}}" data-value="{{ request($name, $value) }}" style="width: 100%;">
+    <select class="form-control {{ $class }}" name="{{$name}}" data-value="{{ $value }}" style="width: 100%;">
         @if($selectAll)
             <option value="">{{trans('admin.all')}}</option>
         @endif
         @foreach($options as $select => $option)
-            <option value="{{$select}}" {{ Dcat\Admin\Support\Helper::equal($select, request($name, $value)) ?'selected':'' }}>{{$option}}</option>
+            <option value="{{$select}}" {{ Dcat\Admin\Support\Helper::equal($select, $value) ?'selected':'' }}>{{$option}}</option>
         @endforeach
     </select>
 </div>

+ 6 - 4
src/Grid/Filter/AbstractFilter.php

@@ -593,17 +593,19 @@ abstract class AbstractFilter
             'id'        => $this->id,
             'name'      => $this->formatName($this->column),
             'label'     => $this->label,
-            'value'     => $this->value(),
+            'value'     => $this->normalizeValue(),
             'width'     => $this->width,
             'style'     => $this->style,
         ], $this->presenter()->variables());
     }
 
-    public function value()
+    protected function normalizeValue()
     {
-        $value = $this->value ?: Arr::get($this->parent->inputs(), $this->column);
+        if ($this->value === '' || $this->value === null) {
+            $this->value = Arr::get($this->parent->inputs(), $this->column);
+        }
 
-        return $value === null || $value === '' ? $this->defaultValue : $value;
+        return $this->value === '' || $this->value === null ? $this->defaultValue : $this->value;
     }
 
     /**