WiceGrid 3.6.0.pre4 examples

Associating columns with database fields

Once a grid column is associated with the inderlying database field with the help of the attrubute parameter the column becomes sortable and a column filter is rendered. The column filter is generated based on the type of the database field.

  • # encoding: utf-8
    class Basics3Controller < ApplicationController
      def index
        @tasks_grid = initialize_grid(Task, order: 'id')
      end
    end
    
  • .well
      %h2= current_page_title
      %p
        Once a grid column is associated with the inderlying database field with the help of the
        %code attrubute
        parameter the column becomes sortable and a column filter is rendered. The column filter
        is generated based on the type of the database field.
    
    = show_code
    
    .row-fluid
      .col-md-12
        = render   'grid'
  • <%# show_filters: :when_filtered %>
    <%= grid(@tasks_grid) do |g|
    
      g.column name:  'ID', attribute: 'id' do |task|
        task.id
      end
    
      g.column name:  'Title', attribute: 'title'  do |task|
        task.title
      end
    
      g.column  name:  'Description', attribute: 'description' do |task|
        task.description
      end
    
      g.column  name:  'Archived', attribute: 'archived' do |task|
        task.archived? ? 'Yes' : 'No'
      end
    
      g.column name:  'Due Date', attribute: 'due_date' do |task|
        task.due_date
      end
    
    
      g.column   do |task|
        link_to('Edit', edit_task_path(task))
      end
    end -%>
    
IDTitle DescriptionArchivedDue Date

1-20 / 500 Alle rijen tonen
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