In this guide, I will show you how to
Bulk Operation with Hotwire.
How it Works
- We can build a Stimulus controller to handle the click event of the button for
- The Stimulus controller will collect the
idof the selected items, and then send data to the server using native
fetchor 3-party js lib such as
- The server can process request according to the
id, and return
Turbo Streamto update the page item details.
- Once Stimulus controller receive the response, use
Turbo.renderStreamMessage(streamActionHTML)to process the HTML which contains Turbo Stream code.
Select All work, you can also use this Stimulus Controller Stimulus Checkbox Select All