我试图使用无页面实现而没有任何成功,演示似乎相当有限,让我深入了解在新java中使用无页面。当我运行并向下滚动时,会出现加载消息和gif,但不会更新......
在ApplicableIc.retrieve中返回从此查询中找到的结果
paginate(:page => params[:page], :per_page => 40, :conditions => [retrieve_cond,*values],
:order => "#{params[:order]}, qrisk, platform, submodule, feature, root_name, suite_name, case_name, ic_name")
在控制器
中def current_objects
if !params[:project_id].blank? && !params[:start_date].blank? && !params[:end_date].blank?
@current_objects ||= ApplicableIc.retrieve(params.merge(:order => "root_name,suite_name,case_name,ic_name"))
if !@current_objects.any?
flash.now[:error] = "No Results for these parameters, please change your inputs"
end
@current_objects
end
end
在html.haml视图中
.container#applicable_ics
-if @applicable_ics
%table
%thead
%tr
%th= sortable "Executed Platforms"
%th= sortable "Passed Platforms"
...
%tbody=render :partial => "applicable_ics"
= will_paginate(@applicable_ics)
= pageless(250, "Loading next '#{@applicable_ics.per_page}' of '#{@applicable_ics.total_entries}' rows", @applicable_ics.total_pages, "#{url_for params.except(:page).merge(:format => :js)}")
应用程序助手
def pageless(distance, loaderMsg, total_pages, url=nil, container=nil)
yell "comes here pageless"
opts = {
:distance => distance,
:totalPages => total_pages,
:url => url,
:loaderMsg => loaderMsg,
:loaderImage => image_path("indicator.gif")
}
container && opts[:container] ||= container
javascript_tag("$('#applicable_ics tbody').pageless(#{opts.to_json});")
end
任何见解,指导或帮助将不胜感激
答案 0 :(得分:0)
好的,你将“条件”和“顺序”键传递给paginate构造函数。应使用活动记录查询它们。
更改
paginate(:page => params[:page], :per_page => 40, :conditions => [retrieve_cond,*values],
:order => "#{params[:order]}, qrisk, platform, submodule, feature, root_name, suite_name, case_name, ic_name")
到此
YourModel.find(:all, :conditions => [retrieve_cond,*values]).paginate(:page => params[:page], :per_page => 40).order("#{params[:order]}, qrisk, platform, submodule, feature, root_name, suite_name, case_name, ic_name")