1
votes

i dont know how exactly explain this I have a list paged.. with picture, name, .. and a button that opens a modal.

my first item has this button

    <button x-on:click="Livewire.emit('showModal', 40338456744)"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Listo para Envio</span></button>

when i go to page 2 for example my first item has this button

    <button x-on:click="Livewire.emit('showModal', 40337432127)"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Listo para Envio</span></button>

but when i click on the button the showModal function receives again the first id 40338456744.

I dont understand why ?!

public function showModal($id = null)
{
    dd($id);
}
1

1 Answers

0
votes

I have updated the code with this solution

changed

    x-on:click="Livewire.emit('showModal', 40337432127)"

with

    wire:click="$emit('showModal', 40337432127)"

and now is working good.. maybe there is any problem with javascript call function. I dont know.