刷新Kaminari中当前页面的数据

时间:2017-06-20 02:26:07

标签: javascript jquery ruby-on-rails ajax kaminari

我使用Kaminari库来记录某些记录。这些是我使用的文件。

视图/用户/ show.html.haml

%table.table.table-striped
%thead
  %tr
    %th Lead ID
    %th Date/Time
    %th Property Address
    %th Connection
    %th Response Time
%tbody#showings
  = render '/showings/list', showings: @showings
#paginator
    = paginate @showings, remote: true, params: {controller: "showings", action: 'index'}

视图/放映/ _list.html.haml

- showings.each do |showing|
  %tr
    %td= showing.id
    %td= showing.created_at_formated
    %td= showing.address
    %td= showing.connected?
    %td= showing.reply_time_mins_secs

ShowingsController

class ShowingsController < ApplicationController
  def index
    @showings = Showing.all.page(current_page)
  end
end

视图/放映/ index.js.erb的

$('#paginator').html('<%= escape_javascript(paginate(@showings, :remote => true).to_s) %>');
$('#showings').html('<%= escape_javascript(render "/showings/list", showings: @showings) %>');

因此,我需要能够刷新当前页面的数据。是否可以使用AJAX或JQuery刷新de数据?只有#paginator和#showings部分。目前,当我按下当前页面的按钮时没有任何反应。

0 个答案:

没有答案