Skip to content

Conversation

@marksalmon
Copy link
Collaborator

No description provided.

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

} 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

3 participants