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
81-100 / 150 show all
262eos1.13.0Edit
263non1.01.1Edit
268quasi minima magni3.0Edit
272fugit maiores consequaturEdit
280corporis1.11.0Edit
286excepturi deleniti corporis3.0Edit
289quasi2.0Edit
292excepturi hic1.0Edit
293sed est est1.21.1Edit
294fugiat eveniet1.2Edit
299consequaturEdit
301autem perspiciatis1.02.0Edit
303eosEdit
309architecto esse autEdit
310quis modi1.2Edit
319et voluptatem2.01.1Edit
320quo corrupti aut1.1Edit
326similique maiores esse1.0Edit
328earum3.02.0Edit
337est2.0Edit

Fork me on GitHub