Thank you Yaroslavl, excellent tutorial. You are so quick, but luckily we can stop and start the video to catch up, unlike an in person tutorial! I am not able to figure out how the highlighting works, and that is a really neat feature. Is it embedded in Tailwind? That is the only part of your setup that I am not using.
@@frankrobinson1007 using highlight: - docs apidock.com/rails/v6.1.7.7/ActionView/Helpers/TextHelper/highlight - good examples: boringrails.com/tips/rails-highlight-search-results
Як завжди - чудовий і дуже корисний матеріал! Ярослав, ти майстер своєї справи! Дякую. Прим. Якби була трохи складніша розмітка, може б запхнув би цю таблицю (разом із сортуванням, фільтрацією) у турбо фрейм щоб оновлювати тільки її контент. Слава Україні!
yep, it will be a greate tutorial.@@SupeRails In my case, I already use ransak, pagy, turbo stream and frame in tables (like you did tutrorials before th-cam.com/video/A9q6YwhLCyI/w-d-xo.html) But I have issues with sort_link, when I take filtered data. By the way, thanks a lot, and plz. continue your greate work
@@volodymyrshabaldas6349 If both turbo_request and turbo_stream are used within one action in the controller, it would be better to separate them to avoid complicating the logic of their interaction. In my opinion, it is better to have turbo_frame + broadcast or turbo_stream + broadcast. Although there are exceptions in real projects)
Thanks, Yaroslav! Your videos are always interesting and useful! I have one question, though. When you do the sort, the gem makes it very easy, and when you click on the column's title it sorts the column right away. My question is, once I load the page how can I have some kind of default sorting already executed, without clicking on any particular column's title? So, the table should have some initial sort (let's say by first_name: DSC) and then the user could change it by clicking on the different column's title.
if you are using ransack, the best way to set default sort order is with "@q.sorts". Example: @q = Event.where(visible: true).ransack(params[:q]) @q.sorts = "name asc" if @q.sorts.empty? @events = @q.result(distinct: true)
Thank you man. This is the most detailed guide for datatables implementation! These gems are really useful
This is so helpful! Thank you for sharing. Please continue your rails tutorials!
Thank you for these tutorials. I like that you make mistakes in the video, and then resolve them. It helps others learn how to diagnose errors.
This became helpful to me today, thanks.
Thank you Yaroslavl, excellent tutorial. You are so quick, but luckily we can stop and start the video to catch up, unlike an in person tutorial! I am not able to figure out how the highlighting works, and that is a really neat feature. Is it embedded in Tailwind? That is the only part of your setup that I am not using.
@@frankrobinson1007
using highlight:
- docs apidock.com/rails/v6.1.7.7/ActionView/Helpers/TextHelper/highlight
- good examples: boringrails.com/tips/rails-highlight-search-results
@@frankrobinson1007 & glad you liked it! 🤗
Як завжди - чудовий і дуже корисний матеріал!
Ярослав, ти майстер своєї справи!
Дякую.
Прим. Якби була трохи складніша розмітка, може б запхнув би цю таблицю (разом із сортуванням, фільтрацією) у турбо фрейм щоб оновлювати тільки її контент.
Слава Україні!
turbo frames and complex markup problems? ok, in the next video!
yep, it will be a greate tutorial.@@SupeRails
In my case, I already use ransak, pagy, turbo stream and frame in tables (like you did tutrorials before th-cam.com/video/A9q6YwhLCyI/w-d-xo.html)
But I have issues with sort_link, when I take filtered data.
By the way, thanks a lot, and plz. continue your greate work
@@volodymyrshabaldas6349 what kind of issues with sort link?
It display turbo request in UI (views), when I tried to press sort link after filtered data @@SupeRails
@@volodymyrshabaldas6349
If both turbo_request and turbo_stream are used within one action in the controller, it would be better to separate them to avoid complicating the logic of their interaction.
In my opinion, it is better to have turbo_frame + broadcast or turbo_stream + broadcast. Although there are exceptions in real projects)
This is great content as always! Thank you
Thanks for watching!
Omg super useful gems and video, thanks a lot !
Glad it was helpful!
Love this. A great find! Subscribed 🎉
Exactly what I was looking for, thank you.
thanks sir for the tutorial it was really helpful
Thanks, Yaroslav! Your videos are always interesting and useful! I have one question, though. When you do the sort, the gem makes it very easy, and when you click on the column's title it sorts the column right away. My question is, once I load the page how can I have some kind of default sorting already executed, without clicking on any particular column's title? So, the table should have some initial sort (let's say by first_name: DSC) and then the user could change it by clicking on the different column's title.
if you are using ransack, the best way to set default sort order is with "@q.sorts".
Example:
@q = Event.where(visible: true).ransack(params[:q])
@q.sorts = "name asc" if @q.sorts.empty?
@events = @q.result(distinct: true)
without ransack:
@events = Event.all.order(created_at: :desc)
Thank you
there is rsome issue of ransack with rails 7.1 , don't know how much time will it take to be compatible with rails 7.1
actually for this tutorial I am using rails 7.1 - seems to work!
Gem Ransack: github.com/activerecord-hackery/ransack