如何在引导程序模态中添加分页 [英] How to add pagination inside a bootstrap modal

查看:78
本文介绍了如何在引导程序模态中添加分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个user's list,当单击显示活动"时,它以部分文件_user_activities.html.haml中的模式显示用户活动的列表.此活动列表是分页视图.我只想在模态窗口中单独为此活动添加分页.这该怎么做?我已经在使用will_paginate,这使得我的页面可以重新加载.如何实现这一目标?

I have a user's list, when click on 'show activities' this shows a list of user activities in a modal from partial file _user_activities.html.haml. This activities list is a paginated view. I want to add pagination only for this activities alone inside my modal window. How to do this? I am already using will_paginate, that makes my page to reload. How to achieve this?

users/index.html.haml

users/index.html.haml

%table
  %thead
    %th Name
    %th Actions
  %tbody
    - @users.each do |user|
      %tr
        %td= user.name
        %td
          %i.icon-play
          %div.modal.hide
            = render 'user_activities', user: user

= will_paginate users

:javascript
  $('i').click(function() {
    $(this).next(.modal).modal('show');
  });

users/_user_activities.html.haml

users/_user_activities.html.haml

%table
  %thead
    %th Name
    %td Type
  %tbody
    - user.activities.eadch do |activity|
      %tr
        %td= activity.name
        %td= activity.type

= will_paginate user.activities

推荐答案

实现ajax类型分页的一种方法是使用 Kaminary 宝石.我们可以轻松地与Kaminary建立分页.我不知道如何使用will_paginate来实现ajax类型的分页,但是我在项目之一中使用了kaminary,因此非常容易.

One way to achieve the ajax type pagination is with Kaminary gem. We can easily set up the pagination with Kaminary. I don't know how to achieve the ajax type pagination with will_paginate, but i used kaminary in my one of project and its quite easy with this.

更新

检查如何使用will_paginate gem实现ajax分页用于为ajax类型的分页提供will_paginate.

Check How to Implement ajax pagination with will_paginate gem for providing the ajax type pagination with will_paginate.

这篇关于如何在引导程序模态中添加分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆