WiceGrid 3.6.0.pre4 examples

External filters (example with 2 grids)

An example of two grids with detached filters functioning independantly of each other.

  • # encoding: utf-8
    class DetachedFiltersTwoGridsController < ApplicationController
      def index
        @grid1 = initialize_grid(Task)
        @grid2 = initialize_grid(Task, name: 'grid2')
      end
    end
    
  • <%= define_grid(tasks_grid, hide_submit_button: true, hide_reset_button: true) do |g|
    
      g.column name:  'ID', attribute: 'id', detach_with_id: :id_filter
    
      g.column name:  'Title', attribute: 'title', detach_with_id: :title_filter
    
      g.column  name:  'Description', attribute: 'description', detach_with_id: :description_filter
    
      g.column  name:  'Archived', attribute: 'archived', detach_with_id: :archived_filter do |task|
        task.archived? ? 'Yes' : 'No'
      end
    
    
      g.column name:  'Due Date', attribute: 'due_date', detach_with_id: :due_date do |task|
        task.due_date.to_s(:db)
      end
    
    
      g.column   do |task|
        link_to('Edit', edit_task_path(task))
      end
    
    end -%>
    
  • .well
      %h2= current_page_title
      %p
        An example of two grids with detached filters functioning independantly of each other.
    
    = show_code
    
    = render   'grid', tasks_grid: @grid1
    = render   'grid', tasks_grid: @grid2
    
    .row
      .col-md-2
        ID:
      .col-md-4
        = grid_filter @grid1, :id_filter
      .col-md-2
        ID:
      .col-md-4
        = grid_filter @grid2, :id_filter
    
    
    .row
      .col-md-2
        Title:
      .col-md-4
        = grid_filter @grid1, :title_filter
      .col-md-2
        Title:
      .col-md-4
        = grid_filter @grid2, :title_filter
    
    
    
    .row
      .col-md-2
        Description:
      .col-md-4
        = grid_filter @grid1, :description_filter
      .col-md-2
        Description:
      .col-md-4
        = grid_filter @grid2, :description_filter
    
    
    .row
      .col-md-2
        Archived:
      .col-md-4
        = grid_filter @grid1, :archived_filter
      .col-md-2
        Archived:
      .col-md-4
        = grid_filter @grid2, :archived_filter
    
    
    .row
      .col-md-2
        Due date:
      .col-md-4
        = grid_filter @grid1, :due_date
      .col-md-2
        Due date:
      .col-md-4
        = grid_filter @grid2, :due_date
    
    
    .row
      .col-md-6
        .external-buttons-grid1
          %button.btn.btn-primary.wg-external-submit-button{'data-grid-name' => 'grid'} Submit
          %button.btn.btn-default.wg-external-reset-button{'data-grid-name' => 'grid'} Reset
    
      .col-md-6
        .external-buttons-grid2
          %button.btn.btn-primary.wg-external-submit-button{'data-grid-name' => 'grid2'} Submit
          %button.btn.btn-default.wg-external-reset-button{'data-grid-name' => 'grid2'} Reset
    
    %p
    
    .row
      .col-md-6
        = render_grid(@grid1)
    
      .col-md-6
        = render_grid(@grid2)
    
ID:
ID:
Title:
Title:
Description:
Description:
Archived:
Archived:
Due date:

Due date:

IDTitleDescriptionArchivedDue Date
81-100 / 500 Alle rijen tonen
81ad quo dolorTempora culpa laborum et illum suscipit facilis earum et.No2016-05-18Edit
82utEt debitis enim repellat qui voluptatem a nam nisi.No2016-01-12Edit
83enimUt molestias ducimus dignissimos.No2016-10-14Edit
84doloreOdio laboriosam velit pariatur ea autem distinctio.No2016-05-28Edit
85voluptatibus inventoreHarum aliquam amet et inventore.Yes2016-06-03Edit
86adipisciConsectetur optio rerum facilis explicabo enim consequatur delectus iste.No2016-02-07Edit
87nostrumTempore ad qui velit nihil ipsam.No2016-03-31Edit
88culpaOccaecati aut eum vero quasi dolorem.No2016-10-19Edit
89provident consequatur remSint at soluta earum.No2016-08-20Edit
90commodi et quisConsequatur soluta eligendi et consequatur.No2016-05-30Edit
91quaeratFacere ullam veniam inventore ea.No2016-06-17Edit
92est praesentiumModi pariatur voluptatem perspiciatis.No2016-01-19Edit
93autId vero doloremque animi unde.No2016-09-20Edit
94officiisIllum minus rerum expedita.No2016-02-01Edit
95quibusdam beatae adVoluptas aperiam beatae architecto provident cum.Yes2016-03-06Edit
96impedit explicabo voluptatemHic eveniet pariatur non nostrum.No2016-10-25Edit
97voluptatem facilis etIncidunt dolorem molestias deserunt repellat vero aut.No2016-05-26Edit
98aperiam rerumRerum quaerat eligendi voluptatem.Yes2016-07-19Edit
99solutaOfficiis omnis esse est debitis laboriosam.No2016-10-12Edit
100autem nonMinus autem provident ex culpa sit.No2016-08-04Edit
IDTitleDescriptionArchivedDue Date
41-60 / 500 Alle rijen tonen
41estIpsum illo corrupti nesciunt facere.No2016-04-09Edit
42autEt eaque dignissimos magnam.No2016-08-25Edit
43impedit atque minimaAperiam expedita autem porro enim veniam.Yes2016-08-15Edit
44id temporibus eligendiId dignissimos dolorem enim ut.No2016-03-11Edit
45rerumRepellat et ut eos ea illo et dolorum voluptatem.No2016-03-06Edit
46facereEst nesciunt molestiae labore ut.Yes2016-09-21Edit
47temporibus iure delectusCumque placeat aut vel repellat omnis accusamus error odio.No2016-02-11Edit
48qui inciduntDignissimos harum ut ea veritatis ut.No2016-08-02Edit
49laborumFacere perferendis sapiente atque.No2016-09-28Edit
50ipsum nam temporeBlanditiis totam ab aut.No2016-03-23Edit
51harum qui possimusNemo odio id ut quam praesentium esse.No2016-08-24Edit
52eos temporibus omnisSapiente accusamus recusandae sunt animi voluptates dolorem enim.No2016-05-23Edit
53molestiaeConsequatur explicabo quos unde esse a distinctio sapiente voluptas.No2016-06-04Edit
54minima in voluptatemFacilis vitae et voluptatem similique quas dolore ipsam.No2016-10-04Edit
55dolorError odio possimus labore.No2016-04-10Edit
56sitVoluptate enim perspiciatis nihil nisi necessitatibus quo dignissimos.No2016-09-10Edit
57nequeNisi mollitia ipsam autem est voluptas consequatur expedita.No2016-05-24Edit
58atque etEst alias est non debitis omnis voluptatem.No2016-03-29Edit
59alias liberoRepudiandae praesentium aut nobis saepe.No2016-01-09Edit
60voluptas repellendusTempora suscipit quibusdam rerum expedita aut.No2016-05-02Edit

Fork me on GitHub