Power-Components / livewire-powergrid

⚡ PowerGrid generates modern, powerful and easy-to-customize data tables using Laravel Livewire.
https://livewire-powergrid.com
MIT License
1.46k stars 215 forks source link

DatePicker: Can't reset the datepicker filter. Undefined array key "start" #1372

Closed slavatriput closed 7 months ago

slavatriput commented 7 months ago

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.1.9

PowerGrid

5.3.3

Laravel

10.43.0

Livewire

3.4.4

Alpine JS

3.0.1

Theme

Tailwind 3.x with tailwind/forms

Describe the bug.

I have a filter Filter::datepicker('created_at', 'products.created_at'). This filter cannot be reset using the badge with a cross that clears the filter. An error occurs: Undefined array key "start".

To Reproduce...

To reproduce:

1) Create a filter for the field created_at. 2) Select with filter records that are knowingly not in the database (not created within the selected range). 3) Now try to cancel (reset) the filter. 4) Catch the exception: Undefined array key "start".

Specify settings in config: 'flatpickr' => [ 'locales' => [ 'ru' => [ 'locale' => 'ru', 'dateFormat' => 'Y-m-d', 'enableTime' => false, 'time_24hr' => false, ], ], ],

Extra information

<?php
 //...
luanfreitasdev commented 7 months ago

Thank you for reporting this issue.

Fixed: https://github.com/Power-Components/livewire-powergrid/releases/tag/v5.3.5

slavatriput commented 7 months ago

if (!isset($values['start']) || isset($values['end'])) { return; }

wrong condition. Filter will newer work

luanfreitasdev commented 7 months ago

Good catch. Can you send a Pull Request?