mysterious-car-3675
02/15/2023, 2:57 AMmysterious-car-3675
02/15/2023, 3:40 AMHX-Location
header is there any else I need to set? (Like a return that's not 200?) I have the response header set and the page does have htmx. If instead I put a boosted link on page that does work.mysterious-toddler-20573
02/15/2023, 3:42 AMmysterious-car-3675
02/15/2023, 3:42 AMmysterious-toddler-20573
02/15/2023, 3:43 AMmysterious-car-3675
02/15/2023, 3:43 AMmysterious-car-3675
02/15/2023, 3:46 AMmysterious-car-3675
02/15/2023, 3:47 AMfunction fr(s,l...
is ever getting hitmysterious-car-3675
02/15/2023, 3:49 AMmysterious-car-3675
02/15/2023, 3:50 AMmysterious-car-3675
02/15/2023, 3:54 AMsparse-psychiatrist-6723
02/15/2023, 4:12 AM<!-- The Response contains both the fragment for normal replace and the oob swap fragment
This will put part of the OOB into the normal target #table-body-->
<tbody id="table-body">
<tr>
<td>First</td>
<td>Second</td>
<td>Third</td>
<td>Fourth</td>
</tr>
</tbody>
<div class="paging-container" hx-swap-oob="true" id="pagingcontainer">Strange Swap!</div>
<!-- When you use just the OOB in the response it replaces the #pagingcontainer properly -->
<div class="paging-container" hx-swap-oob="true" id="pagingcontainer">Strange Swap!</div>
<!-- When you use just the normal swap fragment with no OOB fragment it replaces in the target fine -->
<tbody id="table-body"><tr><td>First</td><td>Second</td><td>Third</td><td>Fourth</td></tr></tbody>
Am I doing something wrong? Or might this be a bug/orange-umbrella-16693
02/15/2023, 8:24 AMsome-airline-73512
02/15/2023, 10:29 AMripe-action-67367
02/15/2023, 10:40 AMclean-piano-67951
02/15/2023, 12:31 PMdocument.addEventListener('htmx:afterSwap', function (event) {
console.log("Running checkCookie() function")
// Check if the "current" cookie has a value of "0"
if (document.cookie.includes("current=0")) {
// Add the "hidden" class to the button with id "prevBtn"
document.getElementById("prevBtn").classList.add("hidden");
}
if (document.cookie.includes("max=1")) {
// Add the "hidden" class to the button with id "prevBtn"
document.getElementById("nextBtn").classList.add("hidden");
document.getElementById("nextBtn").classList.remove("hidden");
}
else {
// Remove the "hidden" class from the button with id "prevBtn"
document.getElementById("prevBtn").classList.remove("hidden");
}
});
clean-piano-67951
02/15/2023, 12:32 PMclean-piano-67951
02/15/2023, 12:32 PMclean-piano-67951
02/15/2023, 12:36 PMclean-piano-67951
02/15/2023, 12:46 PMmysterious-toddler-20573
02/15/2023, 1:56 PMsparse-psychiatrist-6723
02/15/2023, 1:56 PM<input class="field-input filter-input"
hx-include="#sort-criteria"
hx-indicator="#filter-ind"
hx-post="..."
hx-select="#table-body"
hx-select-oob="#pagingcontainer"
hx-swap="outerHTML swap:.4s"
hx-target="#table-body"
hx-trigger="keyup changed delay:500ms, search"
id="filter-input"
name="filter"
placeholder="Type to filter results"
type="search">
And here is the response from the server:
<div>
<tbody id="table-body">
<tr>
<td>First</td>
<td>Second</td>
<td>Third</td>
<td>Fourth</td>
</tr>
</tbody>
<div class="paging-container"
hx-swap-oob="true"
id="pagingcontainer">Strange Swap!</div>
</div>
This will result in the OOB division getting swapped in properly, but the tbody just disappears from the DOM. I had to wrap both elements in a to even get that OOB to work.mysterious-toddler-20573
02/15/2023, 1:57 PMmysterious-toddler-20573
02/15/2023, 1:57 PMsparse-psychiatrist-6723
02/15/2023, 2:00 PMsparse-psychiatrist-6723
02/15/2023, 2:01 PMsparse-psychiatrist-6723
02/15/2023, 2:02 PMmysterious-toddler-20573
02/15/2023, 2:16 PMsparse-psychiatrist-6723
02/15/2023, 2:24 PMmysterious-toddler-20573
02/15/2023, 2:34 PM