WiceGrid 3.6.0.pre4 examples

Auto reloading filters

It is possible to reload the grid on each filter action like changing the selected option in a dropdown filter or typing in a text filter. One way to do it is to use auto_reload: true for each column. Another way is changing Wice::Defaults::AUTO_RELOAD in the WiceGrid config file.

  • # encoding: utf-8
    class AutoReloadsController < ApplicationController
      def index
        @tasks_grid = initialize_grid(Task,
          custom_order: {
            'tasks.priority_id' => 'priorities.name',
            'tasks.status_id' => 'statuses.position',
            'tasks.project_id' => 'projects.name'
          },
          order: 'id',
          order_direction: 'asc'
        )
      end
    end
    
  • .well
      %h2= current_page_title
      %p
        It is possible to reload the grid on each filter action like changing the selected option in a dropdown filter or typing in a text filter.
        One way to do it is to use
        %code auto_reload:  true
        for each column. Another way is changing
        %code Wice::Defaults::AUTO_RELOAD
        in the WiceGrid config file.
    
    = show_code
    
    .row-fluid
      .col-md-12
        = render   'grid'
  • <%= grid(@tasks_grid,  hide_submit_button: true) do |g|
    
      g.column name:  'ID', attribute: 'id', auto_reload:  true , filter_type: :range
    
      g.column name:  'Title', attribute: 'title', auto_reload:  true, negation: true
    
      g.column name:  'Archived', attribute: 'archived', auto_reload:  true do |rec|
        rec.archived? ? 'Yes' : 'No'
      end
    
    
      g.column name:  'Status', attribute: 'status_id', custom_filter: Status.to_dropdown, auto_reload:  true  do |task|
        task.status.name if task.status
      end
    
      g.column name:  'Project Name', attribute: 'project_id', custom_filter: Project.to_dropdown, auto_reload:  true do |task|
        task.project.name if task.project
      end
    
      g.column name:  'Due Date', attribute: 'due_date', auto_reload:  true do |task|
        task.due_date if task.due_date
      end
    
    
      g.column name:  'Added', attribute: 'created_at', auto_reload:  true do |task|
        task.created_at.to_s(:db)
      end
    
      g.column   do |task|
        link_to('Edit', edit_task_path(task))
      end
    end -%>
ID TitleArchivedStatusProject NameDue DateAdded


61-80 / 500 Alle rijen tonen
61quia architectoNoAssignedDivine Firmware2016-08-022015-05-15 12:37:19Edit
62eum velit saepeNoAssignedDivine Firmware2016-10-182015-03-15 12:37:19Edit
63accusamusNoNewSuper Game2016-09-172015-04-15 12:37:19Edit
64reiciendisNoNewSuper Game2016-04-122015-03-30 12:37:19Edit
65eosYesStartedSuper Game2016-07-312015-04-21 12:37:19Edit
66vitae at autemNoPostponedSuper Game2016-06-162015-05-06 12:37:19Edit
67officia quo maioresNoCancelledSuper Game2016-10-052015-06-15 12:37:19Edit
68exercitationem delectusNoPostponedDivine Firmware2016-10-012015-05-12 12:37:19Edit
69similique placeat ipsaNoDuplicateDivine Firmware2016-03-192015-05-08 12:37:19Edit
70autemNoStartedUltimate Website2016-08-042015-03-25 12:37:19Edit
71atNoResolvedSuper Game2016-07-132015-04-28 12:37:19Edit
72illum explicabo modiNoVerifiedSuper Game2016-05-272015-06-16 12:37:19Edit
73iure architectoNoPostponedUltimate Website2016-08-202015-04-05 12:37:19Edit
74molestiaeNoPostponedUltimate Website2016-03-052015-05-22 12:37:19Edit
75velit non magniNoDuplicateDivine Firmware2016-09-162015-05-07 12:37:19Edit
76totamNoNewUltimate Website2016-09-062015-03-31 12:37:19Edit
77sed quibusdam isteNoNewDivine Firmware2016-06-182015-06-03 12:37:19Edit
78exercitationem sapienteNoClosedDivine Firmware2016-06-182015-04-07 12:37:19Edit
79animiNoVerifiedSuper Game2016-05-062015-05-04 12:37:19Edit
80corrupti officiaNoAssignedSuper Game2016-09-292015-03-12 12:37:19Edit

Fork me on GitHub