How to Add Filtering & Pagination to Your Data Tables With Hotwire
VloĆŸit
- Äas pĆidĂĄn 30. 05. 2024
- Having a way to filter records in a table was always clunky in Rails because you'd either have to write a lot of javascript and figure out how to make it work with pagination, or you'd not use Javascript at all and only do it server-side but that didn't feel very responsive and modern.
But thankfully now that we have Hotwire, adding filtering to a table with pagination can be done in just a few minutes.
đ„ Join my new Ruby on Rails Class here: mixandgo.com/rails-class
đ Buy my Bulletproof Ruby on Rails Applications eBook: j.mp/2OtFCdR
đż Hotwire playlist: âą Ruby on Rails - Hotwire
Github Repository: github.com/mixandgo/hotwire_f...
My website: mixandgo.com
#rubyonrails #rails7 #hotwire #stimulusjs #turbo #ruby #webdev
Super helpful, Cezar. Thanks for the details on updating a frame other than the one initiating the action.
Glad to hear you like it.
You explain how it works and I think how easy it is to implement. Thank you! Nice video anyway!
straight to the point. Love it.
Thanks
Nice one and well explained. Thanks for sharing !
Thank you
I love the information density of your videos, excellent job!
I'm glad you like them :)
@@mixandgo really amazing, I appreciate it much
And having the chapters in the video helps a lot. To find quickly the stuff that you saw at some point but u'you forgotten.
Just wonderful. Thanks
My pleasure :)
Great Job.
Thank you
Very good
Great video! Do you know how we would add the link_extra: to the Kaminari gem?
One option is to generate the views and customize the links github.com/kaminari/kaminari#customizing-the-pagination-helper.
You could replace `remote: remote` with `data: { turbo_action: "advance" }` like this:
```
```
Do you have guides for sorting? Can't find good guides for sorting or integrating dataTables to rails 7.
Thanks!
I don't think I do. The closest might be this one: czcams.com/video/4MUEQVxUbm4/video.html which is how I would probably do sorting as well.
@@mixandgo Thanks! Will check it out.
amazing
Thank you
Hello, thanks for the video.
Just a question, I configured the form controller but it is not searching automatically, only when I press Enter
Do you have a keyup handler?
@@mixandgo I did it, apparently there was an error with my Hotwire, I reconfigured it, did a yarn build and it worked.
Thanks for the answer, in January I'm going to buy your Rails 7 course, there's a lot of cool new stuff.
@@eutcb it's great to hear it worked đ
@@mixandgo one more thing, every time I modify a stimulus controller, I need to run yarn build and start rails again. it's normal?
@@eutcb no, that's not normal. Don't you have a ./bin/dev script?
Did I miss the bit where you explain why you can't use elements or did you just decide to skip that entirely?
Tables don't allow you to mix in other tags.
this video is outdated. Today it's version 5.10
For me, 'items: x' not working
What is version 5.10?
@@mixandgo I'm talking about pahy but sorry I am a noob xD
I think my 'items: 10' don't work because I render a partial for my contacts and not the '@contacts'
@@clementblgr6498 you mean "pagy". Well, that's still at version 5.10 (which is what I use in the video)
@@mixandgo yeah pagy sorry, everything is okay now !
It was just because I dont loop on '@contacts' but on 'current_user.contacts'.
Sorry for wasting your time.
Btw you are doing really useful videos but maybe a little bit fast ':D
@@clementblgr6498 thanks, I appreciate the feedback.
i really love your videos, But as a developer just starting using RoR you go really fast and not that detailed explanations. can you improve that for us noobs?
There's a lot going on in these videos, and I'm not sure speed is your main problem if you're a noob.
These videos are less about learning Rails, and more like cool stuff you can build with Rails.
But I get your point. I'll see what I can do.
These videos aren't for noobs