WiceGrid 3.6.0.pre4 examples

Dropping the block in #column

If the contents of the cell is the return value of calling :attrubute on the active record, without any additional markup or transformations, the block of the column method can be dropped.

  • # encoding: utf-8
    class BlocklessColumnDefinitionController < ApplicationController
      def index
         @tasks_grid = initialize_grid(Task, order: 'id')
      end
    end
    
  • <%= grid(@tasks_grid) do |g|
    
      g.column name:  'ID', attribute: 'id'
    
      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'
    
    
      g.column   do |task|
        link_to('Edit', edit_task_path(task))
      end
    end -%>
    
  • .well
      %h2= current_page_title
      %p
        If the contents of the cell is the return value of calling
        %code :attrubute
        on the active record, without any additional markup or transformations, the
        block of the
        %code column
        method can be dropped.
    
    = show_code
    
    .row-fluid
      .col-md-12
        = render   'grid'
ID TitleDescriptionArchivedDue Date

461-480 / 500 show all
461dolor voluptasItaque quibusdam repellat in.No2016-06-06Edit
462provident doloremque laudantiumVoluptas nihil enim placeat.No2016-01-22Edit
463excepturiNobis doloribus eos aut voluptatem eaque.No2016-08-22Edit
464culpaError deleniti qui quaerat sint.No2016-04-17Edit
465totamQui adipisci aspernatur qui non.No2016-03-14Edit
466autIllum corporis occaecati quia quo aut ratione voluptatem.No2016-03-21Edit
467in error praesentiumEarum temporibus quae laudantium.No2016-02-04Edit
468officiisUt a qui quod saepe unde excepturi.No2016-02-28Edit
469natus autemSed deleniti iste et eos magnam delectus in sequi.Yes2016-10-08Edit
470et nonQuia eaque consequatur minima ut pariatur.No2016-07-25Edit
471illo ut evenietSed esse et sit qui iste odit sint ex.No2016-05-09Edit
472perspiciatisNihil qui dolore dignissimos dicta.No2016-03-13Edit
473voluptatum quiBlanditiis quisquam ut eos eum.No2016-03-22Edit
474possimusAut quia quia a et assumenda voluptas.No2016-06-30Edit
475rerum perspiciatis eumSoluta non et temporibus.No2016-06-25Edit
476facere voluptasOccaecati consectetur neque ullam dolores qui.Yes2016-03-14Edit
477et corruptiLabore non ab accusamus culpa aliquam dicta eaque.No2016-06-10Edit
478necessitatibusQui omnis tempora velit.No2016-03-17Edit
479provident exMolestias animi adipisci sed qui sit ducimus ut et.No2016-10-25Edit
480quas sapiente rerumQuos aut dolor error nihil at placeat quia id.No2016-07-10Edit

Fork me on GitHub