I have three files: Controller:
def index
@filterrific = initialize_filterrific(
DimDictionary,
params[:filterrific],
select_options: {},
persistence_id: 'shared_key',
default_filter_params: {},
available_filters: [ :dictionary_word_filter ]
) || return
@dictionaries = @filterrific.find.limit(30)
respond_to do |format|
format.html {render layout: false}
format.js {render layout: false}
end
end
Index.html.haml
= form_for_filterrific @filterrific do |f|
.ui.form
.fields
.field
Filter Word
= f.text_field :dictionary_word_filter
= render_filterrific_spinner
= render(partial: '/test/list', locals: { dictionaries: @dictionaries })
Index.js.erb
<% alert("hi"); %>
<% console.log('working Mannnnn') %>
<% js = escape_javascript(render(partial: '/test/list', locals: { dictionaries: @dictionaries })) %>
$("#filterrific_results").html("<%= js %>");
The Index.js.erb
is not getting triggered. Every time the page loads, its should run the Index.js.erb
and show the alert and the console.log and the show the html right?
I am here using filterrific gem
for filtration purpose but the index.js.erb file never gets triggered.
Even i have includes the js format in my controller. How should it be ? am i doing something wrong?
Aucun commentaire:
Enregistrer un commentaire