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):
23
23
hx_confirm = "Are you sure?" ,
24
24
# Target the closest row (The one you clicked on)
25
25
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 " )))
28
28
29
29
# Sample data
30
30
# Often this would come from a database
@@ -43,11 +43,8 @@ def index(sess):
43
43
# A `Contact` object is rendered as a row automatically using the `__ft__` method
44
44
Tbody (* (Contact (** x ) for x in sess ['contacts' ])))
45
45
46
-
47
46
@app .delete
48
47
def delete (id : int , sess ):
49
48
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
-
52
49
53
50
serve ()
You can’t perform that action at this time.
0 commit comments