#How to hide or remove the TR when I delete the model?

2 messages · Page 1 of 1 (latest)

clear gust
#

The below code works as expected. How can I make the entire <tr> of the row either be removed once the click happens, or hide it?

I have a component called Table.

@foreach($behaviors as $index => $behavior)
    <livewire:behavior-row :behavior="$behavior" :wire:key="$behavior->id" :show-child="$showChild" />
@endforeach
//Inside behavior-row.blade.php
<tr>
  ...
  <a wire:click.prevent="deleteBehavior({{ $behavior->id }})"
</tr>
azure prawn
#

you must play with x-cloak x-show and x-data (for convenient implementation)

since the behavior-row is a nested component, on the wire:click method (which is deleteBehaviour) emitUp an event and with the x-data @entangle you will hide or show the row you target