robsontenorio / mary

Laravel Blade UI Components for Livewire 3
https://mary-ui.com
Other
804 stars 88 forks source link

Selectable Tables with UUID keys #479

Open alexcutts opened 3 weeks ago

alexcutts commented 3 weeks ago

maryUI version

1.32

daisyUI version

4.12.2

Livewire version

3.5

What browsers are affected?

Chrome

What happened?

This may be intended behaviour but I use ulid models (but this would equally apply to uuid keys)

The selectable component uses x-model to track the selected items. In the code, this is implemented as

<input
    type="checkbox"
    class="checkbox checkbox-sm checkbox-primary"
    value="{{ data_get($row, $selectableKey) }}"
    x-model.number="selection"
    @click="toggleCheck($el.checked, {{ json_encode($row) }})" />

The number modifier on x-model means that there is some very buggy behaviour - the first click adds 1 to the array and then it sort of works but not in a reliable way.

The fix would appear to just be removing the .number modifier but I'm not sure if this will introduce issues on the backend for numerical ids.

I have tested locally amending to x-model and it fixes all of the issues I was having.

Happy to submit a PR if this should be fixed.

robsontenorio commented 2 weeks ago

@alexcutts

Please, send a PR. Appreciate if you can test it for numerical ids.

robsontenorio commented 1 week ago

Could you please try this branch? Let me know if it's ok.

composer require robsontenorio/mary:dev-table-improvements
 php artisan view:clear
ANJANS commented 4 days ago

Vai jūs, lūdzu, varētu izmēģināt šo filiāli? Ļaujiet man zināt, vai tas ir labi.

composer require robsontenorio/mary:dev-table-improvements
 php artisan view:clear

I checked. This now works with uuid!