Rails #147 DataTables - search, sort, pagination with Ransack and Pagy
Datatables - tables that you can search, sort, and paginate.
Gem Ransack is an great tool that I use in most of my apps to add search and sort.
Let's dive deep into how we can use Ransack!
At the end, we will also add pagination of our search results with gem Pagy.
When I was starting this channel, a
Ransack video was one of my first ideas.
But ransack is a tool that has so many features, I just didn't know how to approach it in an easy-to-learn manner.
I hope you enjoy the example usecases I demonstrate in this screencast.
0:00 DataTables example
1:40 Ransack SORT
7:13 Ransack SEARCH
9:15 highlight search results
10:15 Date search fields
11:53 Select fields
13:45 One search field for many attributes
14:50 Search association
19:43 Ransack settings
22:08 Pagination with Pagy
24:20 Search, Sort and Pagination works!