WiceGrid 3.6.0.pre4 examples

Custom filters: turning off multiple selection

Use allow_multiple_selection: false to turn off mutiple selection in custom filters.

  • # encoding: utf-8
    class CustomFilters4Controller < ApplicationController
      def index
        @tasks_grid = initialize_grid(Task,
          include: [:relevant_version, :expected_version, :project],
          conditions: ['projects.id = ?', Project.first],
          custom_order: {
            'tasks.expected_version_id' => 'expected_versions_tasks.name'
          }
        )
      end
    end
    
  • .well
      %h2= current_page_title
      %p
        Use
        %code allow_multiple_selection:  false
        to turn off mutiple selection in custom filters.
    
    = show_code
    
    .row-fluid
      .col-md-12
        = render   'grid'
  • <%= grid(@tasks_grid) do |g|
    
      g.column name:  'ID', attribute: 'id', filter: false
    
      g.column name:  'Title', attribute: 'title'
    
      g.column name:  'Found in version', assoc: :relevant_version,
               attribute: 'name', custom_filter: :auto, allow_multiple_selection:  false do |task|
        task.relevant_version.name if task.relevant_version
      end
    
      g.column name:  'Expected in version', attribute: 'expected_version_id',
               custom_filter: [:expected_version, :to_option], allow_multiple_selection:  false do |task|
        task.expected_version.name if task.expected_version
      end
    
      g.column   do |task|
        link_to('Edit', edit_task_path(task))
      end
    end -%>
IDTitleFound in versionExpected in version
21-40 / 150 Alle rijen tonen
60voluptas repellendusEdit
70autem1.23.0Edit
73iure architecto1.0Edit
74molestiae1.2Edit
76totam1.12.0Edit
84dolore1.2Edit
85voluptatibus inventore1.1Edit
94officiis1.03.0Edit
96impedit explicabo voluptatem3.0Edit
105autem quia1.1Edit
116dolorem consectetur3.02.0Edit
118hic3.0Edit
119quo est aliquid1.1Edit
129voluptates minima molestiaeEdit
132quiaEdit
133optio1.11.1Edit
140mollitia3.0Edit
144est error1.21.1Edit
146adipisci et2.0Edit
150qui rem1.1Edit

Fork me on GitHub