Dynamically update a thymeleaf list #58
-
Can someone point me to a resource to get started with dynamically updating a thymeleaf list with HTMX? I think I drank too much last night and my brain is not working well. I've watched a few demo videos, but still can't quite figure out how to implement this basic functionality, which is: Display a list of items. Click an item to display the next list of items. I have added the
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Do you want to do pagination? Or update an item in the existing list itself? |
Beta Was this translation helpful? Give feedback.
-
Based on https://www.wimdeblauwe.com/blog/2022/06/15/thymeleaf-and-htmx-with-out-of-band-swaps/ it looks like I actually need to return an HtmxResponse, like this:
|
Beta Was this translation helpful? Give feedback.
-
Based on https://github.com/wimdeblauwe/blog-example-code/blob/master/todomvc-htmx-oob/src/main/resources/templates/fragments.html I thought maybe I was missing the hx-trigger, but it's still not working.
|
Beta Was this translation helpful? Give feedback.
-
Got it working. Turns out I was sending the wrong object to the htmx response.
|
Beta Was this translation helpful? Give feedback.
Got it working. Turns out I was sending the wrong object to the htmx response.