-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor fixes #531
base: master
Are you sure you want to change the base?
Minor fixes #531
Conversation
Co-authored-by: StyleCI Bot <[email protected]>
Apply fixes from StyleCI
Co-authored-by: StyleCI Bot <[email protected]>
Co-authored-by: StyleCI Bot <[email protected]>
Co-authored-by: StyleCI Bot <[email protected]>
@@ -1220,6 +1220,7 @@ public function buildDatabaseQuery($export = false) | |||
public function complexQuery($rules) | |||
{ | |||
$this->complexQuery = $rules; | |||
$this->setPage(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -1277,9 +1276,15 @@ public function processNested($rules = null, $query = null, $logic = 'and') | |||
$query->whereNotNull($column); | |||
} 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
No description provided.