Kaminari Ajax paginate doesn't work

吃可爱长大的小学妹 提交于 2019-12-25 02:48:30

问题


I have below view and controller. Though remote: true is mentioned, kaminari calls my method using http(using page refresh). Is there anything i am missing to make my kaminari links ajaxable.

In VIEWS:

<div id="paginate">
  <%= paginate @user, params: {slug: nil, pgsz: 20}, remote: true %>
</div>

In Controller:

@user = Kaminari.paginate_array(@properties, total_count: @search_result.total_count).page(params[:page]).per(params[:pgsz] ||= 20)

I will be responding to ajax in my controller, but first it doesn't even make an ajax call.


回答1:


This is usually because you don't have jquery_ujs loaded, check your app/assets/javascripts/application.js file, it should have these two lines (at least):

//= require jquery
//= require jquery_ujs


来源:https://stackoverflow.com/questions/30988434/kaminari-ajax-paginate-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!