Power-Components / livewire-powergrid

⚡ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.

Home Page:https://livewire-powergrid.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clear Filters not showing when using queryString

carloeusebi opened this issue · comments

Have you searched through other issues to see if your problem is already reported or has been fixed?

Yes, I did not find it.

Did you read the documentation?

Yes, I did not find it.

Have you tried to publish the views?

Yes - I didn't work.

Is there an error in the console?

No

PHP Version

8.3

PowerGrid

5.6

Laravel

11.7

Livewire

3.4

Alpine JS

No response

Theme

Tailwind 3.x with tailwind/forms

Describe the bug.

When using the query string function, on page load the filters are populatad from the params in the query string, but the $enabledFilters is not.
This means that the clear filter button for the filter is not showing.

As you can see in the image beloew, the 'Inizio Terapia' filter was populated from the query and it is not showing in the enabledFilters array, while the 'Stato' filter was just changed by hand, and it showing in the enabledFilters, and it is correctly showing the clear filter button.

The same result heappens for each filter, so it not specific for the 'Inizio Terapia' filter.

It also happens if I use return [ ...$this->powerGridQueryString()] in the queryString as described in the documentation.

Screenshot from 2024-05-22 09-28-30

Extra information

<?php
 //...
    protected function queryString(): array
    {
        return [
            'page' => ['except' => 1, 'as' => 'pagina'],
            'search' => ['except' => '', 'as' => 'cerca'],
            'filters.boolean.archived_at' => ['except' => '', 'as' => 'stato'],
            'filters.date.therapy_start_date' => ['except' => '', 'as' => 'data'],
        ];
    }