Specific Loading target

Hi all,

I use the wire:loading in a table with the targets of “reOpen” and “close”. In these methods I pass an ID.

<button class="btn btn-sm btn-outline-secondary"  
		title="Re-open ticket"
		wire:click="reOpen('{{ $ticket->ticket_id }}')"
		wire:loading.attr="disabled"
		wire:loading.class="loading-hide"
>
	<i class="fas fa-undo"></i>
</button>

<button wire:loading 
	    wire:target="reOpen" 
	    class="btn btn-sm btn-primary" 
	    type="button" disabled
>
	<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
</button>

This works like magic, but when I click on the button that calls the reOpen method, the loading button shows on all other elements. I’ve tried to target reOpen('{{ $ticket->ticket_id }}') and set unique wire:key as well as id on each button, but the loading button not showing.

Is there a way that the loading button can target by wire:key or only method?

Thank you

1 Like