WiceGrid 3.6.0.pre4 examples

More than 1 grid on a page

There can be many grids on one page, but in order to work correctly and independantly from each other they should all have different names. A grid name is the basis and the scope for all CSS classes and HTTP parameters of the grid. By default the name of a grid is grid and in case there is only one grid on a page defining the name is not required unless it clashes with some other form field names. Define the name with the :name parameter of the initialize_grid method.

  • # encoding: utf-8
    class ManyGridsOnPageController < ApplicationController
      def index
        @tasks_grid1 = initialize_grid(Task, name: 'g1')
        @tasks_grid2 = initialize_grid(Task, name: 'g2')
      end
    end
    
  • <%= grid(@tasks_grid2) do |g|
    
      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
    
    
    end -%>
    
  • .well
      %h2= current_page_title
      %p
        There can be many grids on one page, but in order to work correctly and independantly
        from each other they should
        all have  different names. A grid name is the basis and the scope for all CSS classes and HTTP
        parameters of the grid. By default the name of a grid is
        %code grid
        and in case there is only one grid on a page defining the name is not required unless it
        clashes with some other form field names.
        Define the name with the
        %code :name
        parameter of the
        %code initialize_grid
        method.
    
    = show_code
    
    .row-fluid.many-grids-on-page
      .col-md-6
        .example1= render   'tasks_grid1'
      .col-md-6
        .example2= render   'tasks_grid2'
    
    
    
    
  • <%= grid(@tasks_grid1) do |g|
    
      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
    
    
    end -%>
    
TitleDescriptionArchived
461-480 / 500 show all
dolor voluptasItaque quibusdam repellat in.No
provident doloremque laudantiumVoluptas nihil enim placeat.No
excepturiNobis doloribus eos aut voluptatem eaque.No
culpaError deleniti qui quaerat sint.No
totamQui adipisci aspernatur qui non.No
autIllum corporis occaecati quia quo aut ratione voluptatem.No
in error praesentiumEarum temporibus quae laudantium.No
officiisUt a qui quod saepe unde excepturi.No
natus autemSed deleniti iste et eos magnam delectus in sequi.Yes
et nonQuia eaque consequatur minima ut pariatur.No
illo ut evenietSed esse et sit qui iste odit sint ex.No
perspiciatisNihil qui dolore dignissimos dicta.No
voluptatum quiBlanditiis quisquam ut eos eum.No
possimusAut quia quia a et assumenda voluptas.No
rerum perspiciatis eumSoluta non et temporibus.No
facere voluptasOccaecati consectetur neque ullam dolores qui.Yes
et corruptiLabore non ab accusamus culpa aliquam dicta eaque.No
necessitatibusQui omnis tempora velit.No
provident exMolestias animi adipisci sed qui sit ducimus ut et.No
quas sapiente rerumQuos aut dolor error nihil at placeat quia id.No
TitleDescriptionArchived
461-480 / 500 show all
dolor voluptasItaque quibusdam repellat in.No
provident doloremque laudantiumVoluptas nihil enim placeat.No
excepturiNobis doloribus eos aut voluptatem eaque.No
culpaError deleniti qui quaerat sint.No
totamQui adipisci aspernatur qui non.No
autIllum corporis occaecati quia quo aut ratione voluptatem.No
in error praesentiumEarum temporibus quae laudantium.No
officiisUt a qui quod saepe unde excepturi.No
natus autemSed deleniti iste et eos magnam delectus in sequi.Yes
et nonQuia eaque consequatur minima ut pariatur.No
illo ut evenietSed esse et sit qui iste odit sint ex.No
perspiciatisNihil qui dolore dignissimos dicta.No
voluptatum quiBlanditiis quisquam ut eos eum.No
possimusAut quia quia a et assumenda voluptas.No
rerum perspiciatis eumSoluta non et temporibus.No
facere voluptasOccaecati consectetur neque ullam dolores qui.Yes
et corruptiLabore non ab accusamus culpa aliquam dicta eaque.No
necessitatibusQui omnis tempora velit.No
provident exMolestias animi adipisci sed qui sit ducimus ut et.No
quas sapiente rerumQuos aut dolor error nihil at placeat quia id.No

Fork me on GitHub