Skip to content

Commit

Permalink
Merge pull request #460 from Power-Components/revert-459-bugfix/enum-…
Browse files Browse the repository at this point in the history
…select

Revert "fix enum select"
  • Loading branch information
luanfreitasdev authored Jun 2, 2022
2 parents e4627cb + 48d929a commit 8ccf07b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class="power_grid {{ $theme->selectClass }} {{ $class }} {{ data_get($column, 'h
style="{{ data_get($column, 'headerStyle') }}"
wire:input.debounce.500ms="filterSelect('{{ data_get($select, 'dataField') }}','{{ data_get($select, 'label') }}')"
wire:model.debounce.500ms="filters.select.{{ data_get($select, 'dataField') }}">
@if(!boolval(data_get($select, 'isEnum')))
<option value="">{{ trans('livewire-powergrid::datatable.select.all') }}</option>
@endif
<option>{{ trans('livewire-powergrid::datatable.select.all') }}</option>
@foreach(data_get($select, 'data_source') as $relation)
@php
$key = isset($relation['id']) ? 'id' : 'value';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
style="{{ data_get($column, 'headerStyle') }}"
wire:input.debounce.500ms="filterSelect('{{ data_get($select, 'dataField') }}','{{ data_get($select, 'label') }}')"
wire:model.debounce.500ms="filters.select.{{ data_get($select, 'dataField') }}">
@if(!boolval(data_get($select, 'isEnum')))
<option value="">{{ trans('livewire-powergrid::datatable.select.all') }}</option>
@endif
<option value="">{{ trans('livewire-powergrid::datatable.select.all') }}</option>
@foreach(data_get($select, 'data_source') as $relation)
@php
$key = isset($relation['id']) ? 'id' : 'value';
Expand Down
7 changes: 2 additions & 5 deletions src/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,8 @@ public function makeInputSelect(
$this->editable = false;
$this->inputs['select']['data_source'] = $datasource;
$this->inputs['select']['displayField'] = $displayField;
$this->inputs['select']['dataField'] = $dataField ?? $displayField;
$this->inputs['select']['class'] = $settings['class'] ?? '';
$this->inputs['select']['isEnum'] = $settings['isEnum'] ?? false;
$this->inputs['select']['dataField'] = $dataField ?? $displayField;
$this->inputs['select']['class'] = $settings['class'] ?? '';

return $this;
}
Expand Down Expand Up @@ -363,8 +362,6 @@ public function makeInputEnumSelect(array $enumCases, string $dataField = null,

$dataField ??= Str::snake(class_basename($enumCases[0]));

$settings['isEnum'] = true;

return $this->makeInputSelect($dataSource, $displayField, $dataField, $settings);
}

Expand Down

0 comments on commit 8ccf07b

Please sign in to comment.