Skip to content

Commit

Permalink
- Column::hideable string|bool|null has been made possible. Fixed the…
Browse files Browse the repository at this point in the history
… issue of adding mandatory ->hideable() method in all fields.

- Complex Query Undefined array key 0. problem solved
- Complex Query paginate issue resolved
  • Loading branch information
Emre Ubuntu committed Feb 12, 2024
1 parent ad3d01b commit b26f42b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions resources/views/livewire/datatables/complex-query.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
rules: @if($persistKey) $persist('').as('{{ $persistKey }}') @else '' @endif,
init() {
Livewire.on('complexQuery', rules => this.rules = rules)
if (this.rules && this.rules !== '') {
$wire.set('rules', this.rules)
if (this.rules && this.rules !== '' && this.rules.rules !== null) {
$wire.set('rules', this.rules.rules)
$wire.runQuery()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Column implements \ArrayAccess
public bool $sortable = false;
public string|array|null $filterOn = null;
public bool|array $filterable = false;
public bool $hideable;
public string|bool|null $hideable = null;
public ?string $sort = null;
public bool|string $defaultSort = false;
public string|array|Closure|null $callback = null;
Expand Down
2 changes: 2 additions & 0 deletions src/Livewire/ComplexQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
use Illuminate\Support\Collection;
use Livewire\Attributes\On;
use Livewire\Component;

class ComplexQuery extends Component
Expand Down Expand Up @@ -88,6 +89,7 @@ public function deleteRules($id): void
public function resetQuery(): void
{
$this->reset('rules');
$this->dispatch('refreshLivewireDatatable');
$this->runQuery();
}

Expand Down
3 changes: 1 addition & 2 deletions src/Livewire/LivewireDatatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Illuminate\View\View;
use Livewire\Attributes\On;
use Livewire\Component;
use Livewire\WithPagination;
use RuntimeException;
Expand Down Expand Up @@ -1274,8 +1275,6 @@ public function addComplexQuery(): static
$this->processNested($this->complexQuery, $query);
});

$this->setPage(1);

return $this;
}

Expand Down

0 comments on commit b26f42b

Please sign in to comment.