mysterious-toddler-20573
07/24/2022, 2:00 PM[name='element'],[name='element2']
mysterious-toddler-20573
07/24/2022, 2:00 PMmysterious-toddler-20573
07/24/2022, 2:00 PMcalm-queen-64495
07/25/2022, 10:27 AMcalm-queen-64495
07/25/2022, 10:28 AMcalm-queen-64495
07/25/2022, 10:53 AMmysterious-toddler-20573
07/25/2022, 3:21 PMmonitorEvents
in chrome to see what events are being triggered on the input and see if there are any good options: https://htmx.org/docs/#debuggingastonishing-kilobyte-60820
07/27/2022, 12:14 PMhx-swap-oob
. I have this
html
<tr><td><button hx-post="/" hx-target="closest tr" hx-swap="outerHTML"></button></td></tr>
<!-- my response -->
<tr>.....</tr>
That works fine. But when my response is this, the weirdest thing happens.
html
<div id="messages" hx-swap-oob="true">....</div>
<tr>....</tr>
When I do that, the message works but all the html tags get stripped out of my <tr>
so instead I just get whatever text was in the tr
but all tr
tags and td
tags are left out of the response. Any ideas?mysterious-toddler-20573
07/27/2022, 1:17 PMmysterious-toddler-20573
07/27/2022, 1:17 PMastonishing-kilobyte-60820
07/27/2022, 10:59 PMhtml
<meta name="htmx-config" content='{"useTemplateFragments":true}'>
hallowed-architect-39752
07/30/2022, 11:12 PMbase_template
. Its value depends on whether or not the request was used with htmx or not, as per the tip on https://django-htmx.readthedocs.io/en/latest/tips.html.
python
def htmx_base_template(request):
if request.htmx and not request.htmx.boosted:
base_template = "partial.html"
else:
base_template = "base.html"
return {
"base_template": base_template,
}
hallowed-architect-39752
07/30/2022, 11:13 PMaloof-crayon-56651
08/02/2022, 2:30 AMearly-camera-41285
08/02/2022, 10:21 AMaloof-crayon-56651
08/02/2022, 10:39 AMincalculable-holiday-29658
08/04/2022, 7:05 AMred-france-69804
08/04/2022, 2:30 PMListView
and a DeleteView
in Django ? With HTMX, it would be useful to me, to be able to not just remove the deleted object in the list (like in the examples), but to update the DOM with the new table.
I explained my issue here in detail here: https://stackoverflow.com/questions/73237624/django-combine-listview-and-deleteview-to-use-with-htmxblue-ghost-19146
08/04/2022, 2:52 PMHX-Trigger
response header (https://htmx.org/headers/hx-trigger/) to your DeleteView
and listening for it on the list (hx-trigger="myCustomEvent from:body"
) along with the other hx-
attributes required for calling your ListView and thus refreshing the fragment. That's what I do and it seems to work pretty well.hundreds-camera-24900
08/04/2022, 3:58 PMhundreds-camera-24900
08/04/2022, 3:58 PMhundreds-camera-24900
08/04/2022, 3:59 PMred-france-69804
08/04/2022, 4:26 PMhundreds-camera-24900
08/04/2022, 6:15 PMhundreds-camera-24900
08/04/2022, 6:15 PMhundreds-camera-24900
08/04/2022, 6:15 PMhtml
<div class="flex flex-col"
hx-trigger="load"
hx-get="{% url "appointment-list" %}"
hx-target="#appointment-left-content"
hx-swap="innerHTML">
loading appointments..
<img class="self-center"
height="100"
width="100"
src="{% static "img/loading.svg" %}">
</div>
hundreds-camera-24900
08/04/2022, 6:16 PMhundreds-camera-24900
08/04/2022, 6:16 PM