WiceGrid 3.6.0.pre4 examples

Hiding certain checkboxes in the action column

You can hide a certain action checkbox if you add the usual block to g.action_column , just like with the g.column definition. If the block returns nil or false no checkbox will be rendered.

  • # encoding: utf-8
    class HidingCheckboxesInActionColumnController < ApplicationController
      def index
        @tasks_grid = initialize_grid(Task,
          name: 'g',
          order: 'id'
        )
    
        if params[:g] && params[:g][:selected]
          @selected = params[:g][:selected]
        end
      end
    end
    
  • <%= grid(@tasks_grid) do |g|
    
      g.action_column html_check_box: false do |task|
        task.status.name != 'Assigned'
      end
    
    
      g.column name:  'ID', attribute: 'id', filter_type: :range
    
      g.column name:  'Title', attribute: 'title', negation: true
    
      g.column name:  'Archived', attribute: 'archived' do |rec|
        rec.archived? ? 'Yes' : 'No'
      end
    
    
      g.column name:  'Status', attribute: 'status_id', custom_filter: Status.to_dropdown  do |task|
        task.status.name if task.status
      end
    
      g.column name:  'Project Name', attribute: 'project_id', custom_filter: Project.to_dropdown do |task|
        task.project.name if task.project
      end
    
      g.column name:  'Due Date', attribute: 'due_date' do |task|
        task.due_date if task.due_date
      end
    
    
      g.column name:  'Added', attribute: 'created_at' do |task|
        task.created_at.to_s(:db)
      end
    
    end -%>
    
  • .well
      %h2= current_page_title
      %p
        You can hide a certain action checkbox if you add the usual block to
        %code g.action_column
        , just like with the
        %code g.column
        definition. If the block returns
        %code nil
        or
        %code false
        no checkbox will be rendered.
    
    = show_code
    
    = dump_filter_parameters_as_hidden_fields(@tasks_grid)
    = form_for '#', method:  :get do
    
      - if @selected
        .well
          Selected tasks:
          = @selected.to_sentence
    
      .row-fluid
        .col-md-12
          %p
            %button.btn.btn-default{'type' => 'submit'} Process tasks
    
          = render   'grid'
    
          %p
            %button.btn.btn-default{'type' => 'submit'} Process tasks
    

IDTitleArchived StatusProject NameDue DateAdded


1-20 / 500 Alle rijen tonen
22etNoCancelledSuper Game2016-08-282015-05-19 12:37:19
1impedit aperiam liberoNoCancelledDivine Firmware2016-07-272015-05-22 12:37:18
21et rerum laborumNoCancelledSuper Game2016-04-292015-03-19 12:37:18
2ut sintNoAssignedDivine Firmware2016-10-212015-04-09 12:37:18
3aliquam repudiandaeNoAssignedDivine Firmware2016-04-202015-03-21 12:37:18
7ut veniamNoPostponedUltimate Website2016-08-042015-05-10 12:37:18
8nullaNoResolvedDivine Firmware2016-05-222015-04-25 12:37:18
4nisi quiNoVerifiedDivine Firmware2016-05-162015-03-18 12:37:18
10rerum occaecatiNoCancelledSuper Game2016-08-142015-05-22 12:37:18
5dicta pariaturNoPostponedDivine Firmware2016-03-042015-04-19 12:37:18
12explicabo hicNoPostponedDivine Firmware2016-04-152015-05-26 12:37:18
13utNoClosedUltimate Website2016-07-182015-03-22 12:37:18
14repellat consequatur velitNoNewUltimate Website2016-01-102015-05-06 12:37:18
15est ut autNoNewDivine Firmware2016-10-302015-04-17 12:37:18
16omnisNoAssignedSuper Game2016-02-052015-03-21 12:37:18
17itaque suscipit commodiNoStartedSuper Game2016-08-232015-03-30 12:37:18
18necessitatibus commodiNoStartedSuper Game2016-03-282015-03-27 12:37:18
9quisquam in isteNoDuplicateUltimate Website2016-03-072015-06-07 12:37:18
20aspernatur eligendi adipisciNoAssignedUltimate Website2016-06-082015-05-30 12:37:18
23exercitationem autNoClosedDivine Firmware2016-05-212015-04-23 12:37:19


Fork me on GitHub