In one of my projects, I had a table with a lot of rows of uniform data. I started using a JQuery plugin called Sticky Table Headers. It worked really well, but I’ve been experimenting with moving different components of my code to Stimulus, where it made sense, so I thought I’d try to replicate Continue reading “Stimulus.js Tutorial: Listening to onScroll Events for a Sticky Table Header”
Category Archives: Stimulus JS
Stimulus.js Tutorial: How do I filter data in a list or table?
Let’s work off the previous Todo tutorial and add a way to filter those Todos using just Stimulus. We will only need to work on the todos/index.html file, and to add one Javascript controller. This example will highlight how Stimulus enhances your server rendered HTML, without the need to build complicated constellations of Javascript objects. Continue reading “Stimulus.js Tutorial: How do I filter data in a list or table?”
Stimulus.js Tutorial: How Do I Remotely Update My Model from a checkbox?
An updated version of this post can be found here: https://onrails.blog/2020/11/09/updated-tutorial-how-do-i-update-my-model-from-a-checkbox/ First, I’m going to assume you’ve read the Stimulus handbook, cover to cover, like I have. Let’s say you have a Todo app, with a model Todo that has a string title, and a boolean field, completed. We are going to use Stimulus to Continue reading “Stimulus.js Tutorial: How Do I Remotely Update My Model from a checkbox?”
Stimulus.js Tutorial: How Do I Drag and Drop Items in a List?
You’ve heard about Stimulus in the DHH press tour. You’ve read the Stimulus Handbook. How about a more complicated example than what you’ve seen? Here’s a tutorial on using Stimulus to drag and drop items around in a list. Let’s start with our simple ordered list in html. Notice that each item has a id associated Continue reading “Stimulus.js Tutorial: How Do I Drag and Drop Items in a List?”