Page enter with Turbolinks
Good day,
I'm having an issue when entering a page and loading a resource. The resource is Selectize which otherwise working fine but when I enter the page with the functionality it will just not load selectize on the selected dropdown, instead, I need to fully refresh the page and it will work.
I tried adding data-turbolinks-action="replace"
to the a
tag linking to the page but that didnt work.
Also added:
document.addEventListener("turbolinks:load", function() {
$('#employer-list').selectize({
sortField: 'text'
});
});
to the bottom of the page but didn't work either... the only way of actually including Selectize functionality is by refreshing the page. (?) Is there a way of calling .selectize
on page change or load?