Skip to content
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

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open

Minor fixes #531

wants to merge 51 commits into from

Conversation

marksalmon
Copy link
Collaborator

No description provided.

@@ -1220,6 +1220,7 @@ public function buildDatabaseQuery($export = false)
public function complexQuery($rules)
{
$this->complexQuery = $rules;
$this->setPage(1);
Copy link
Collaborator Author

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) {
Copy link
Collaborator Author

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) {
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants