Pageless不能很好地与Rails 3.2一起工作



我尝试过使用pageless来实现,但没有任何成功,而且这个演示在让我了解在新java中使用pageless方面似乎相当有限。当我运行这个并向下滚动时,加载消息和gif出现但不更新…

在ApplicableIc

。检索返回从该查询中找到的结果

  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

任何见解,指导或帮助将不胜感激

首先,您将"conditions"one_answers"order"键传递给分页构造函数。它们应该使用活动记录进行查询。

改变
 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")

相关内容

  • 没有找到相关文章

最新更新