This example shows how to implement click-to-load the next page in a table of data. The crux of the demo is the final row:
<tr id="replaceMe">
<td colspan="3">
<button class='btn' hx-get="/contacts/?page=2"
hx-target="#replaceMe"
hx-swap="outerHTML">
Load More Agents... <img class="htmx-indicator" src="/img/bars.svg">
</button>
</td>
</tr>
This row contains a button that will replace the entire row with the next page of results (which will contain a button to load the next page of results). And so on.
<tr><td>Agent Smith</td><td>void20@null.org</td><td>F2D07D4G08C4191</td></tr>
<tr><td>Agent Smith</td><td>void21@null.org</td><td>FD2G9D6A08960D7</td></tr>
<tr><td>Agent Smith</td><td>void22@null.org</td><td>764CC41E6CG9453</td></tr>
<tr><td>Agent Smith</td><td>void23@null.org</td><td>9DEFA52A5EB0B08</td></tr>
<tr><td>Agent Smith</...
Name | ID | |
---|---|---|
Agent Smith | void10@null.org | FBDA5G8BDFCAED1 |
Agent Smith | void11@null.org | G2AEDAC3EA15EG0 |
Agent Smith | void12@null.org | B54D2E96G09A64F |
Agent Smith | void13@null.org | E44CB9FF118E9BG |
Agent Smith | void14@null.org | F1459446D1736FG |
Agent Smith | void15@null.org | EC40B8867DC5EBB |
Agent Smith | void16@null.org | E9EC00DEG45FE11 |
Agent Smith | void17@null.org | FC8FE184A71BGAA |
Agent Smith | void18@null.org | 6612F36GGG887E2 |
Agent Smith | void19@null.org | 9GEF2E9D70782AF |
Agent Smith | void20@null.org | F2D07D4G08C4191 |
Agent Smith | void21@null.org | FD2G9D6A08960D7 |
Agent Smith | void22@null.org | 764CC41E6CG9453 |
Agent Smith | void23@null.org | 9DEFA52A5EB0B08 |
Agent Smith | void24@null.org | 778EFD6B30A6965 |
Agent Smith | void25@null.org | A8GDCAG0F0F0DEC |
Agent Smith | void26@null.org | 4B92FEGE4FDC2D5 |
Agent Smith | void27@null.org | GD6DC8G8BCC83E4 |
Agent Smith | void28@null.org | CD7CG486CA21GEF |
Agent Smith | void29@null.org | D4FE643G3602678 |
|