Wice_gride不加载所有记录

时间:2019-03-01 01:25:59

标签: ruby-on-rails wice-grid

我在控制器中使用wice_grid gem,如下所示:

  def providers
    @employee_certifications_grid = initialize_grid(EmployeeCertification, 
    include:[:employee,{employee: :orders}] , conditions: {status: "active", 
    employees: {status: "active", orders: {taker_id: current_company.id}}}, 
    order: 'expiration_date',  order_direction: 'asc', per_page: 15 )
  end

页面已成功呈现,并且在底部显示正确数量的结果(16)。但是网格仅显示其中的4个。它并没有显示全部。我发现,如果我将par_page参数更改为54,则会得到所有结果。有什么想法为什么不起作用?

同样的结果是正确的,但是它并没有在网格中显示所有记录。

app/views/providers.html.erb   

<section class="section">
  <div class="columns is-centered">
    <div class="column">
      <%= grid(@employee_certifications_grid) do |g|

        g.column name: 'Colaborador', attribute: 'nome', assoc: :employee, filter: false do |employee_certification|
          employee_certification.employee.nome
        end

        g.column name: 'Documento', attribute: 'name', assoc: :certification, filter: false do |employee_certification|
          employee_certification.certification.name
        end

        g.column name: 'Descição', attribute: 'title', assoc: :certification, filter: false do |employee_certification|
          employee_certification.certification.title
        end

        g.column name: 'Arquivo', filter: false do |employee_certification|
          link_to employee_certification.document.filename, employee_certification.document, target: :_blank 
        end

        g.column name: 'Validade', attribute: 'expiration_date', filter: false do |employee_certification|
          if employee_certification.expiration_date
            if employee_certification.expiration_date < employee_certification.employee.orders.active.minimum(:due)
              [employee_certification.expiration_date.strftime("%d/%m/%Y"), {style: 'background-color: rgb(255, 105, 104);'}]
            else
              employee_certification.expiration_date.strftime("%d/%m/%Y")
            end
          else
            "--"
          end
        end

        g.column name: 'Pedidos', filter: false do |employee_certification|
          link_to 'visualizar pedidos', root_path
        end


      end -%>
    </div>
  </div>
</section>

0 个答案:

没有答案