Rails #147 DataTables - search, sort, pagination with Ransack and Pagy

29/10/2023 (7 months ago)

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.

Episode source code: https://github.com/corsego/147-datatables-ransack-pagy-search-sort-paginate/commit/6581e1311af36870a6cddce883274ea803b4b153

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!


0
Sign in to join the conversation