Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I create a filterer with checkboxs that dynamically search for results?

Owen Roth asked in Rails

Hey everyone,

I am attempting to build a checkbox filter with Rails 7.

I would like to render a list of businesses on a page and have a side panel with a bunch of checkboxes. This side panel would have a checkbox for every city option. When a user clicks the checkbox for "New York", the list of businesses broadcasts the filter query and displays all businesses in New York without refreshing the page / clicking submit.

Are there any resources for how to develop the above? I thought about using a combination of Ransack, Turbo frames, and Stimulus. Essentially what I was thinking was that I would have some "onChange" listeners on the checkboxes then render the filter with some combination of Ransack / Turbo frames. Seems kind of complex. Am I over thinking this?

Reply

I have a dynamic checkbox filter that is generated using php and distinct values from my database. https://medium.com/@stephendolan/rails-shrine-dropzonejs-f9d0944d17e3io games

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.