File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed
examples/dynamic_user_interface_(htmx)/delete_row Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ def __ft__(self):
2323 hx_confirm = "Are you sure?" ,
2424 # Target the closest row (The one you clicked on)
2525 hx_target = "closest tr" ,
26- # Swap out the row with nothing (removes the row)
27- hx_swap = "outerHTML " )))
26+ # Removes the row with htmx
27+ hx_swap = "delete " )))
2828
2929# Sample data
3030# Often this would come from a database
@@ -43,11 +43,8 @@ def index(sess):
4343 # A `Contact` object is rendered as a row automatically using the `__ft__` method
4444 Tbody (* (Contact (** x ) for x in sess ['contacts' ])))
4545
46-
4746@app .delete
4847def delete (id : int , sess ):
4948 sess ['contacts' ] = [c for c in sess ['contacts' ] if c ['id' ] != id ]
50- # Return nothing to the HTMX request to swap in nothing (removes the row)
51-
5249
5350serve ()
You can’t perform that action at this time.
0 commit comments