WiceGrid 3.6.0.pre4 examples

Integration with other forms

In addition to including a grid into a form it is possible to dump the state of filters into another form as a set of hidden parameters with helper dump_filter_parameters_as_hidden_fields(grid_object) .

  • # encoding: utf-8
    class IntegrationWithFormsController < ApplicationController
      def index
        @archived = params[:archived] == '1' ? true : false
    
        @tasks_grid = initialize_grid(Task,
          conditions: { archived: @archived },
          name: 'g'
        )
      end
    end
    
  • <%= grid(@tasks_grid) do |g|
    
      g.column name:  'ID', attribute: 'id', filter_type: :range
    
      g.column name:  'Title', attribute: 'title', negation: true
    
      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
        In addition to including
        %a{href:  action_column_index_path}a grid into a form
        it is possible to dump the state of filters into another form as a set of hidden parameters with helper
        %code dump_filter_parameters_as_hidden_fields(grid_object)
        \.
    
    = show_code
    
    = form_tag(integration_with_forms_path, method:  :get) do
      = dump_filter_parameters_as_hidden_fields(@tasks_grid)
    
      %p= select_tag 'archived', options_for_select([['View active tasks', 0], ['View archived tasks', 1]], @archived ? 1 : 0), class: 'reload-on-change form-control'
    
    
    = render   'grid'
    

IDTitleStatusProject NameDue DateAdded


421-440 / 449 Alle rijen tonen
467in error praesentiumClosedDivine Firmware2016-02-042015-05-12 12:37:26
468officiisClosedSuper Game2016-02-282015-06-07 12:37:26
470et nonCancelledSuper Game2016-07-252015-06-19 12:37:26
471illo ut evenietDuplicateSuper Game2016-05-092015-04-01 12:37:26
472perspiciatisCancelledUltimate Website2016-03-132015-03-26 12:37:26
473voluptatum quiVerifiedUltimate Website2016-03-222015-06-11 12:37:26
474possimusResolvedSuper Game2016-06-302015-03-23 12:37:26
475rerum perspiciatis eumCancelledDivine Firmware2016-06-252015-04-20 12:37:26
477et corruptiNewSuper Game2016-06-102015-05-03 12:37:26
478necessitatibusCancelledDivine Firmware2016-03-172015-05-10 12:37:26
479provident exVerifiedSuper Game2016-10-252015-05-02 12:37:26
480quas sapiente rerumPostponedUltimate Website2016-07-102015-04-25 12:37:26
481etClosedUltimate Website2016-10-232015-06-05 12:37:26
482consequuntur eumDuplicateSuper Game2016-06-052015-05-01 12:37:26
483laborum dictaVerifiedSuper Game2016-02-282015-05-09 12:37:26
484quiaResolvedDivine Firmware2016-05-312015-05-06 12:37:26
485ut teneturDuplicateSuper Game2016-10-132015-06-10 12:37:26
486enim harum minimaResolvedSuper Game2016-09-252015-04-18 12:37:26
487natus etNewUltimate Website2016-01-312015-05-14 12:37:26
488doloribus veritatisClosedUltimate Website2016-04-062015-06-17 12:37:26

Fork me on GitHub