class AjaxLinkRenderer < WillPaginate::LinkRenderer
def page_link_or_span(page, span_class = 'current', text = nil)
text ||= page.to_s
classnames = Array[*span_class]
if page and page != current_page
if @options[:update]
@template.link_to_remote text, :update => @options[:update], :url => url_for(page)
else
@template.link_to text, url_for(page), :rel => rel_value(page), :class => classnames[1]
end
else
@template.content_tag :span, text, :class => classnames.join(' ')
end
end
end
嗯,很好用。在config\initializers下面做成一个.rb。页面上的Ajax分页就可以用了。页面上的处理是下面的代码:
<%= will_paginate @producttradeinfos,
{:class=>'pagination',
:prev_label => '上一页',
:next_label => '下一页',
:renderer => 'AjaxLinkRenderer',
:update => 'results',
:params => {你的参数(如: :q => params[:q])}}%>
分享到:
相关推荐
will_paginate-bootstrap, 将 Twitter Bootstrap 分页组件与will_paginate集成 will_paginate-bootstrap不再维护我不再使用 Bootstrap 来使用 Rails,所以不幸的是,我不再接受请求请求或者维护这个库。 为了发布你...
rails 分页插件will_paginate 2.2.2
rails 分页插件will_paginate 2.1.0
rails 分页插件will_paginate
使用gem 'will_paginate', '~> 3.0.7'实现无限/无限滚动的工作 Rails CRUD 应用程序示例。 gem 'faker'被用来为项目gem 'faker'虚假数据。 演示 现场演示: : 在本地开发中安装 克隆回购: git clone git@github...
Rails Engine扩展了样式以匹配Twitter的 4工具包中的分页样式约定。 安装 添加到您的Gemfile: gem 'will_paginate-bootstrap4' 用法 <%= will_paginate @clients, renderer: WillPaginate::ActionView::...
will_paginate will_paginate是一个分页库,与Ruby on Rails,Sinatra,Hanami :: View,Merb,DataMapper和Sequel集成。 安装: ## Gemfile for Rails 3+, Sinatra, and Merbgem 'will_paginate' , '~> 3.1.0' 有关...
新版本的will_paginate已经抛弃了这样的做法,转而使用gem的方式,本文通过建立一个名为foobar的应用来了解一下will_paginate的用法。 ============================== C:\>rails foobar -d mysql C:\>cd foobar C:\...
=== Will Paginate App请参阅链接: ://richonrails.com/articles/getting-started-with-will-paginate了解更多信息。
will_paginate will_paginate是一个分页库,与Ruby on Rails,Sinatra,Hanami :: View,Merb,DataMapper和Sequel集成。 安装:##用于Rails 3 +,Sinatra和Merb的Gemfile gem'will_paginate','〜> will_paginate ...
介绍插件,用于对记录进行排序(使用 gem)安装要启用rails_admin_acts_as_list,请将以下内容添加到您的Gemfile : gem 'rails_admin_acts_as_list'gem 'rails_admin' 重要提示: rails_admin_acts_as_list之前必须...
Rails 的英文脏话过滤器 这个插件将允许您使用基本替换或字典术语过滤亵渎。
复杂Rails系统架构优化
rails2.0的内容管理系统,可以发布文档、CVS库和Web资源3中资源,其中文档可以上传下载附件。支持打Tag。用户注册登录使用restful_authentication,分页使用will_paginate,Gem版本1.3.5
Api-rails5_api_tutorial.zip,了解如何在michael hartl的rails 5教程上构建一个现代api立即在rails应用程序中构建一个api!(Rails 5版本),一个api可以被认为是多个软件设备之间通信的指导手册。例如,api可用于web...
RestFul_Rails_Dev_v_0.1 RestFul_Rails_Dev_v_0.1
中文世界唯一一本Rails 4.0.0 + Ruby 2.0.0 的自學書籍
InspiniaAdmin 2.6.1 Rails_Full_Version
Rails_Recipes_with_Source_Code
rails_semantic_logger, Rails 语义记录器用语义记录器替换 Rails 缺省记录器 Rails 语义记录器 语义记录器用语义记录器替代 Rails 缺省记录器。http://github.com/rocketjob/rails_semantic_logger文档有关完整文档...