refined-manchester-67193
02/19/2023, 8:05 PMhx-ext="ws" ws-connect="/"
directly on the body
element? Putting it on a div inside of body did help.
- I thought the item we're replacing has to be enclosed inside the item that has those HTML (hx-ext="ws"...
) attrs, but I was able to replace an item outside of it, which is solved the above issue....?refined-manchester-67193
02/19/2023, 8:05 PMhx-ext="debug"
?orange-umbrella-16693
02/19/2023, 9:49 PMripe-action-67367
02/19/2023, 10:29 PMripe-action-67367
02/19/2023, 10:31 PMrefined-manchester-67193
02/19/2023, 10:38 PMeager-psychiatrist-68229
02/20/2023, 10:43 AMsome-airline-73512
02/20/2023, 11:24 AMhx-swap-oob="true"
as you have suggested and it works great for deletion.
The problem I have is when I want to append/prepend element to some other selector. I use hx-swap-oob="afterend:#selector"
, but it replaces innerHTML instead of outerHTML.
So this means that I have to wrap it in some , is that correct? Is there a way to specify like hx-swap-oob="afterend:outerHTML:#selector"
?ripe-action-67367
02/20/2023, 11:33 AMsome-airline-73512
02/20/2023, 11:36 AMsome-airline-73512
02/20/2023, 11:52 AM<div hx-swap-oob="afterend:#t0">
<tr id="..">
<td>internals of cells from response</td>
<td>internals of cells from response</td>
</tr>
</div>
response body goes on ...
And in the page there is:
<table>
<tbody>
<tr id="t0"></tr>
... the rest of the rows
</tbody>
</table>>
So after swap it looks like:
<table>
<tbody>
<tr id="t0"></tr>
<td>internals of cells from response</td>
<td>internals of cells from response</td>
... the rest of the rows
</tbody>
</table>>
ripe-action-67367
02/20/2023, 11:53 AMripe-action-67367
02/20/2023, 11:54 AMsome-airline-73512
02/20/2023, 11:54 AMripe-action-67367
02/20/2023, 11:55 AMsome-airline-73512
02/20/2023, 11:55 AMsome-airline-73512
02/20/2023, 11:55 AMripe-action-67367
02/20/2023, 11:56 AMripe-action-67367
02/20/2023, 12:00 PMripe-action-67367
02/20/2023, 12:00 PMripe-action-67367
02/20/2023, 12:00 PMhtml
<tbody hx-swap-oob="afterend:#row1">
<tr id="row2">
<td>internals of cells from response</td>
<td>internals of cells from response</td>
</tr>
</tbody>
ripe-action-67367
02/20/2023, 12:01 PMsome-airline-73512
02/20/2023, 12:02 PMsome-airline-73512
02/20/2023, 12:04 PMproud-librarian-99598
02/20/2023, 12:28 PMastonishing-cpu-59399
02/20/2023, 1:10 PMhx-target
element in afterSwap event from evt.detail.target
. But, if I change the target in beforeSwap event like evt.detail.target = htmx.find("#result_1");
then I don't get the new target in afterSwap from evt.detail.target
astonishing-cpu-59399
02/20/2023, 1:13 PMearly-notebook-68765
02/20/2023, 6:22 PMmysterious-toddler-20573
02/20/2023, 10:02 PMmysterious-toddler-20573
02/20/2023, 10:02 PM