WiceGrid 3.6.0.pre4 examples

Hidden filter panel

show_filters: :when_filtered in grid hides the filter panel but the user can make it visible by clicking on the "Show filter" panel.

When any of the filters is active the filter panel is shown anyway.

  • # encoding: utf-8
    class WhenFilteredController < ApplicationController
      def index
        @tasks_grid = initialize_grid(Task)
      end
    end
    
  • <%= grid(@tasks_grid, show_filters: :when_filtered) do |g|
    
      g.column name:  'ID', attribute: 'id', filter: false
    
      g.column name:  'Title', attribute: 'title'
    
      g.column  name:  'Description', attribute: 'description'
    
      g.column  name:  'Archived', attribute: 'archived' do |task|
        task.archived? ? 'Yes' : 'No'
      end
    
      g.column name:  'Due Date', attribute: 'due_date', filter: false
    
    
      g.column   do |task|
        link_to('Edit', edit_task_path(task))
      end
    end -%>
    
  • .well
      %h2= current_page_title
      %p
        %code show_filters: :when_filtered
        in
        %code grid
        hides the filter panel but the user can make it visible by clicking on the "Show filter" panel.
      %p
        When any of the filters is active the filter panel is shown anyway.
    
    = show_code
    
    .row-fluid
      .col-md-12
        = render   'grid'
IDTitle DescriptionArchivedDue Date
1-20 / 500 show all
25ab quiFugit id error esse.No2016-05-03Edit
63accusamusPraesentium quod ipsum error odit.No2016-09-17Edit
436accusantiumCorrupti qui mollitia temporibus.No2016-10-01Edit
426accusantium eligendiDebitis dolore id eos tempora.No2016-09-01Edit
370accusantium error exercitationemMolestiae eos quibusdam quod id voluptatem eius.No2016-01-24Edit
168adDolorum id sint assumenda quos consectetur aut eveniet.No2016-10-06Edit
86adipisciConsectetur optio rerum facilis explicabo enim consequatur delectus iste.No2016-02-07Edit
346adipisci at nesciuntEligendi facilis ut consequatur.No2016-10-14Edit
146adipisci etIncidunt porro iure esse.Yes2016-03-01Edit
147adipisci ut asperioresSed sed ullam blanditiis aut consequatur mollitia ipsam et.No2016-08-24Edit
81ad quo dolorTempora culpa laborum et illum suscipit facilis earum et.No2016-05-18Edit
59alias liberoRepudiandae praesentium aut nobis saepe.No2016-01-09Edit
3aliquam repudiandaeConsequatur iste similique dolorum ducimus ut.No2016-04-20Edit
188aliquid adipisciEaque maxime mollitia in vel.No2016-08-15Edit
139aliquid oditOccaecati veritatis asperiores vitae aut.No2016-10-11Edit
230aliquid rerum modiFugit hic blanditiis esse alias.Yes2016-07-20Edit
215aliquid sed suntQuis sed voluptate voluptatibus voluptatem doloremque et.Yes2016-07-29Edit
79animiCorporis est inventore nesciunt est nam voluptas et.No2016-05-06Edit
447animi accusantium utSequi dolorem distinctio sit doloremque et corporis voluptatem alias.No2016-10-15Edit
175aperiam omnisNisi qui itaque quia quaerat.No2016-04-17Edit

Fork me on GitHub