Conversation
Co-authored-by: StyleCI Bot <bot@styleci.io>
Apply fixes from StyleCI
…s/livewire-datatables into relation-refactor
…s/livewire-datatables into relation-refactor
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: StyleCI Bot <bot@styleci.io>
…s/livewire-datatables into relation-refactor
Co-authored-by: StyleCI Bot <bot@styleci.io>
| public function complexQuery($rules) | ||
| { | ||
| $this->complexQuery = $rules; | ||
| $this->setPage(1); |
There was a problem hiding this comment.
Pagination is broken when using complex query because $this->setPage(1) is called on every refresh. Moved here so it is only called when the query is set
| } elseif ($this->columns[$rule['content']['column']]['type'] === 'boolean') { | ||
| if ($rule['content']['value'] === 'true') { | ||
| $query->whereNotNull(Str::contains($column, '(') ? DB::raw($column) : $column); | ||
| $query->where(function ($query) use ($column) { |
There was a problem hiding this comment.
This fixes boolean logic so that zero = false
| return $value->preventExport == true || $value->hidden == true; | ||
| })->mapWithKeys(function ($value, $key) use ($item) { | ||
| return [$value->label ?? $value->name => $item->{$value->name}]; | ||
| return collect($this->columns)->reject(function ($value) { |
There was a problem hiding this comment.
I have reverted this to get columns from $this->columns rather than $this->columns()
Otherwise the export does not respect which fields are shown/hidden.
$this->columns() will respect the hard-coded column definitions, whereas $this->columns respects the dynamic user-selected shown/hidden columns.
In my tables I want the users to be able to export the columns they have selected, but if the other behaviour is preferred then we should give the ability to change behaviour with a config variable
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: StyleCI Bot <bot@styleci.io>
No description provided.