jhund / filterrific

Filterrific is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists.
http://filterrific.clearcove.ca
MIT License
911 stars 125 forks source link

Compatibility Fix for Hotwire Rails & Turbo #199

Open enderwiggens opened 3 years ago

enderwiggens commented 3 years ago

It looks like there is a compatibility issue with the new Hotwire Rails / Turbo.js framework and how Filterrific is initialized.

As turbolinks has been expanded and renamed to turbo, the turbolinks:load call is now turbo:load so to have Filterrific initialize you need to use the following in filterrific.js

$(document).on('turbo:load', function() {
  Filterrific.init();
});
btrewern commented 3 years ago

Well this all depends if you are using Turbolinks, Turbo or neither. I think the best way to support these is to remove initialization from the filterrific-jquery.js file and add documentation so that each developer can add Filterrific.init in their own code.